Arthur Heymans has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/36407 )
Change subject: soc/intel/(fsp_)baytrail: Initialize SPI before console init
......................................................................
soc/intel/(fsp_)baytrail: Initialize SPI before console init
This makes the spi flash console function during romstage. It was
tested with the FSP baytrail codepath but it's a safe assumption that
the same fix also applies for the google mrc.bin codepath.
Tested on Intel Minnowboard Turbot.
Change-Id: If6ef0eeea902ab76d398d0218ee943e482f69b43
Signed-off-by: Arthur Heymans <arthur(a)aheymans.xyz>
---
M src/soc/intel/baytrail/romstage/romstage.c
M src/soc/intel/fsp_baytrail/romstage/romstage.c
2 files changed, 5 insertions(+), 3 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/07/36407/1
diff --git a/src/soc/intel/baytrail/romstage/romstage.c b/src/soc/intel/baytrail/romstage/romstage.c
index 7c129e2..e06c39e 100644
--- a/src/soc/intel/baytrail/romstage/romstage.c
+++ b/src/soc/intel/baytrail/romstage/romstage.c
@@ -165,10 +165,10 @@
if (CONFIG(ENABLE_BUILTIN_COM1))
byt_config_com1_and_enable();
- console_init();
-
spi_init();
+ console_init();
+
set_max_freq();
punit_init();
diff --git a/src/soc/intel/fsp_baytrail/romstage/romstage.c b/src/soc/intel/fsp_baytrail/romstage/romstage.c
index f347591..78aa9fc 100644
--- a/src/soc/intel/fsp_baytrail/romstage/romstage.c
+++ b/src/soc/intel/fsp_baytrail/romstage/romstage.c
@@ -171,9 +171,11 @@
byt_config_com1_and_enable();
post_code(0x43);
- console_init();
spi_init();
+
+ console_init();
+
baytrail_rtc_init();
/* Call into mainboard. */
--
To view, visit https://review.coreboot.org/c/coreboot/+/36407
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: If6ef0eeea902ab76d398d0218ee943e482f69b43
Gerrit-Change-Number: 36407
Gerrit-PatchSet: 1
Gerrit-Owner: Arthur Heymans <arthur(a)aheymans.xyz>
Gerrit-MessageType: newchange
Xiang Wang has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/36944 )
Change subject: arch/riscv: Fix cpu capabilities detection function
......................................................................
arch/riscv: Fix cpu capabilities detection function
On some platforms, misa may not be implemented. On such a platform,
reading misa will get zero. At this time, soc is required to
implement a non-standard method to detect the soc function.
This modification add interfaces for non-standard function.
The MXL field of misa is always at the highest two bits, whether it
is a 32-bit 64-bit or a 128-bit machine. Therefore, this modification
fixes the use of a fixed offset to detect the machine length.
Change-Id: Id24f77bf21ef0c7c300faa477d67294d093eeecc
Signed-off-by: Xiang Wang <merle(a)hardenedlinux.org>
---
M src/arch/riscv/Makefile.inc
A src/arch/riscv/cpu.c
M src/arch/riscv/include/arch/cpu.h
3 files changed, 87 insertions(+), 3 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/44/36944/1
diff --git a/src/arch/riscv/Makefile.inc b/src/arch/riscv/Makefile.inc
index 0038523..0679be73 100644
--- a/src/arch/riscv/Makefile.inc
+++ b/src/arch/riscv/Makefile.inc
@@ -60,6 +60,7 @@
bootblock-y += trap_util.S
bootblock-y += trap_handler.c
bootblock-y += fp_asm.S
+bootblock-y += cpu.c
bootblock-y += misaligned.c
bootblock-y += sbi.c
bootblock-y += mcall.c
@@ -100,6 +101,7 @@
romstage-y += boot.c
romstage-y += romstage.c
romstage-y += misc.c
+romstage-y += cpu.c
romstage-$(ARCH_RISCV_PMP) += pmp.c
romstage-y += smp.c
romstage-y += \
@@ -137,6 +139,7 @@
ramstage-y += trap_util.S
ramstage-y += trap_handler.c
ramstage-y += fp_asm.S
+ramstage-y += cpu.c
ramstage-y += misaligned.c
ramstage-y += sbi.c
ramstage-y += virtual_memory.c
diff --git a/src/arch/riscv/cpu.c b/src/arch/riscv/cpu.c
new file mode 100644
index 0000000..69556f3
--- /dev/null
+++ b/src/arch/riscv/cpu.c
@@ -0,0 +1,27 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright 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.
+ */
+
+#include <arch/cpu.h>
+
+
+__weak int soc_supports_extension(char ext)
+{
+ return 0;
+}
+
+__weak int soc_machine_xlen(void)
+{
+ return -1;
+}
diff --git a/src/arch/riscv/include/arch/cpu.h b/src/arch/riscv/include/arch/cpu.h
index c62199e..72a8a69 100644
--- a/src/arch/riscv/include/arch/cpu.h
+++ b/src/arch/riscv/include/arch/cpu.h
@@ -18,6 +18,7 @@
#include <arch/encoding.h>
#include <device/device.h>
+#include <commonlib/compiler.h>
#define asmlinkage
@@ -42,15 +43,68 @@
uint8_t riscv_model;
};
+/* If the SOC does not implement misa, the read misa will be zero.
+ * Such SOC requires a non-standard mechanism to detect ISA extensions.
+ * If the soc does not implement misa, implement this function.
+ * */
+int soc_supports_extension(char ext);
+
static inline int supports_extension(char ext)
{
- return read_csr(misa) & (1 << (ext - 'A'));
+ uintptr_t isa = read_csr(misa);
+ if (isa)
+ return isa & (1 << (ext - 'A'));
+ else
+ return soc_supports_extension(ext);
}
+/* If the SOC does not implement misa, the read misa will be zero.
+ * Such SOC requires a non-standard mechanism to detect machine XLEN.
+ * If the soc does not implement misa, implement this function.
+ * */
+int soc_machine_xlen(void);
+
static inline int machine_xlen(void)
{
- int mxl = (read_csr(misa) >> (__riscv_xlen - 2)) & 3;
- return (1 << mxl) * 16;
+ int r;
+ asm (
+ "csrr t0, misa\n\t"
+ "bnez t0, 1f\n\t"
+ "call soc_machine_xlen\n\t"
+ "j 2f\n"
+ "1:\n\t"
+ "srli t1, t0, 30\n\t"
+ "srli t1, t1, 32\n\t"
+ "srli t1, t1, 32\n\t"
+ "srli t1, t1, 32\n\t"
+ "andi t1, t1, 3\n\t"
+ "li t2, 3\n\t"
+ "bne t1, t2, 1f\n\t"
+ "li %0, 128\n\t"
+ "j 2f\n"
+ "1:\n\t"
+ "srli t1, t0, 30\n\t"
+ "srli t1, t1, 32\n\t"
+ "andi t1, t1, 3\n\t"
+ "li t2, 2\n\t"
+ "bne t1, t2, 1f\n\t"
+ "li %0, 64\n\t"
+ "j 2f\n"
+ "1:\n\t"
+ "srli t1, t0, 30\n\t"
+ "andi t1, t1, 3\n\t"
+ "li t2, 1\n\t"
+ "bne t1, t2, 1f\n\t"
+ "li %0, 32\n\t"
+ "j 2f\n"
+ "1:\n\t"
+ "li %0, -1\n"
+ "2:"
+ : "=r"(r)
+ :
+ : "t0", "t1", "t2", "ra"
+ );
+ return r;
}
struct cpu_info *cpu_info(void);
--
To view, visit https://review.coreboot.org/c/coreboot/+/36944
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: Id24f77bf21ef0c7c300faa477d67294d093eeecc
Gerrit-Change-Number: 36944
Gerrit-PatchSet: 1
Gerrit-Owner: Xiang Wang <merle(a)hardenedlinux.org>
Gerrit-MessageType: newchange
Name of user not set #1002701 has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/37533 )
Change subject: Revert commit bfb5c807e720761f4457d5106bb919f2aacb5535 binaryPI: Drop PSP Secure OS from build
......................................................................
Revert commit bfb5c807e720761f4457d5106bb919f2aacb5535 binaryPI: Drop PSP Secure OS from build
For AMD Bettong board to boot these changes should be reverted.
Change-Id: I903824019ebbe7934dbe12297b3a223cab3461c5
Signed-off-by: Jorge Fernandez <jorgefm(a)cirsa.com>
---
M src/southbridge/amd/pi/hudson/Makefile.inc
1 file changed, 7 insertions(+), 7 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/33/37533/1
diff --git a/src/southbridge/amd/pi/hudson/Makefile.inc b/src/southbridge/amd/pi/hudson/Makefile.inc
index 0eccadb..33f59c7 100644
--- a/src/southbridge/amd/pi/hudson/Makefile.inc
+++ b/src/southbridge/amd/pi/hudson/Makefile.inc
@@ -85,10 +85,10 @@
FIRMWARE_TYPE=
PSPBTLDR_FILE=$(top)/$(FIRMWARE_LOCATE)/PspBootLoader.Bypass.sbin
-#PSPRCVR_FILE=$(top)/$(FIRMWARE_LOCATE)/PspRecovery.sbin
-#PSPSCUREOS_FILE=$(top)/$(FIRMWARE_LOCATE)/PspSecureOs.sbin
-#PSPTRUSTLETS_FILE=$(top)/$(FIRMWARE_LOCATE)/trustlets.bin
-#TRUSTLETKEY_FILE=$(top)/$(FIRMWARE_LOCATE)/Trustlet.tkn.cert
+PSPRCVR_FILE=$(top)/$(FIRMWARE_LOCATE)/PspRecovery.sbin
+PSPSCUREOS_FILE=$(top)/$(FIRMWARE_LOCATE)/PspSecureOs.sbin
+PSPTRUSTLETS_FILE=$(top)/$(FIRMWARE_LOCATE)/trustlets.bin
+TRUSTLETKEY_FILE=$(top)/$(FIRMWARE_LOCATE)/Trustlet.tkn.cert
endif
ifeq ($(CONFIG_CPU_AMD_PI_00660F01), y)
@@ -103,12 +103,12 @@
SMUFIRMWARE2_FILE=$(top)/$(FIRMWARE_LOCATE)/SmuFirmware2_prod_CZ.sbin
endif
-#PUBSIGNEDKEY_FILE=$(top)/$(FIRMWARE_LOCATE)/RtmPubSigned$(FIRMWARE_TYPE).key
-#PSPNVRAM_FILE=$(top)/$(FIRMWARE_LOCATE)/PspNvram$(FIRMWARE_TYPE).bin
+PUBSIGNEDKEY_FILE=$(top)/$(FIRMWARE_LOCATE)/RtmPubSigned$(FIRMWARE_TYPE).key
+PSPNVRAM_FILE=$(top)/$(FIRMWARE_LOCATE)/PspNvram$(FIRMWARE_TYPE).bin
SMUFWM_FILE=$(top)/$(FIRMWARE_LOCATE)/SmuFirmware$(FIRMWARE_TYPE).sbin
SMUFWM_FN_FILE=$(top)/$(FIRMWARE_LOCATE)/SmuFirmware$(FIRMWARE_TYPE)_FN.sbin
SMUSCS_FILE=$(top)/$(FIRMWARE_LOCATE)/SmuScs$(FIRMWARE_TYPE).bin
-#PSPSECUREDEBUG_FILE=$(top)/$(FIRMWARE_LOCATE)/PspSecureDebug$(FIRMWARE_TYPE).Key
+PSPSECUREDEBUG_FILE=$(top)/$(FIRMWARE_LOCATE)/PspSecureDebug$(FIRMWARE_TYPE).Key
endif
--
To view, visit https://review.coreboot.org/c/coreboot/+/37533
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I903824019ebbe7934dbe12297b3a223cab3461c5
Gerrit-Change-Number: 37533
Gerrit-PatchSet: 1
Gerrit-Owner: Name of user not set #1002701
Gerrit-Reviewer: Martin Roth <martinroth(a)google.com>
Gerrit-Reviewer: Name of user not set #1002701
Gerrit-Reviewer: Patrick Georgi <pgeorgi(a)google.com>
Gerrit-MessageType: newchange
Jude Rich has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/37939 )
Change subject: utils/kconfig/nconf.c: Fix truncation warning in `item_add_str`
......................................................................
utils/kconfig/nconf.c: Fix truncation warning in `item_add_str`
While appending a string in `item_add_str`, there is a warning about truncating
the string to 256 bytes due to unnecessary buffering. By removing the buffering
and writing directly to the string, the warning is vanquished.
Signed-off-by: Jude A Rich <juder11(a)gmail.com>
Change-Id: Idb2dfad7e401954f4bb83d0409ab71dcd7277f47
---
M util/kconfig/nconf.c
1 file changed, 18 insertions(+), 17 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/39/37939/1
diff --git a/util/kconfig/nconf.c b/util/kconfig/nconf.c
index 905dcd1..4181c41 100644
--- a/util/kconfig/nconf.c
+++ b/util/kconfig/nconf.c
@@ -561,32 +561,33 @@
curses_menu_items[items_num] = NULL;
}
-/* very hackish. adds a string to the last item added */
+/* add a string to the last item added */
static void item_add_str(const char *fmt, ...)
{
va_list ap;
- int index = items_num-1;
- char new_str[256];
- char tmp_str[256];
+ char *append_ptr; /* pointer to the free space in the target string */
+ int index = items_num-1; /* index of item to append string */
+ int kmi_str_len; /* length of initial string */
+ int str_space; /* length of unused space in string */
+ /* return if there's no item to work with */
if (index < 0)
return;
- va_start(ap, fmt);
- vsnprintf(new_str, sizeof(new_str), fmt, ap);
- va_end(ap);
- snprintf(tmp_str, sizeof(tmp_str), "%s%s",
- k_menu_items[index].str, new_str);
- strncpy(k_menu_items[index].str,
- tmp_str,
- sizeof(k_menu_items[index].str));
+ kmi_str_len = strlen(k_menu_items[index].str);
+ str_space = sizeof(k_menu_items[index].str) - kmi_str_len;
+ append_ptr = k_menu_items[index].str + kmi_str_len;
+ /* append the string */
+ va_start(ap, fmt);
+ vsnprintf(append_ptr, str_space, fmt, ap);
+ va_end(ap);
+
+ /* set menu item to new item string */
free_item(curses_menu_items[index]);
- curses_menu_items[index] = new_item(
- k_menu_items[index].str,
- k_menu_items[index].str);
- set_item_userptr(curses_menu_items[index],
- &k_menu_items[index]);
+ curses_menu_items[index] = new_item(k_menu_items[index].str,
+ k_menu_items[index].str);
+ set_item_userptr(curses_menu_items[index], &k_menu_items[index]);
}
/* get the tag of the currently selected item */
--
To view, visit https://review.coreboot.org/c/coreboot/+/37939
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: Idb2dfad7e401954f4bb83d0409ab71dcd7277f47
Gerrit-Change-Number: 37939
Gerrit-PatchSet: 1
Gerrit-Owner: Jude Rich <juder11(a)gmail.com>
Gerrit-MessageType: newchange
Subrata Banik has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/34992 )
Change subject: soc/intel/common: Make use of clflush in common platform_segment_loaded
......................................................................
soc/intel/common: Make use of clflush in common platform_segment_loaded
This patch clear cache lines based on platform_segment_loaded() supplied
start and size values before loading the targeted stage.
This changes is required to fix hang issues appeared due to marking DRAM
ranges as WB (CONFIG_MARK_DRAM_CACHE_WB) to speed up next stage loading/
decompression/execution time.
Idea is to run clflush on those ranges just before tearing down the CAR
(running invd instruction) and after that postcar frame will set up new MTRR
ranges.
Change-Id: I591f21cb4199477af271f0dd6c073e1c11831bfd
Signed-off-by: Subrata Banik <subrata.banik(a)intel.com>
---
M src/soc/intel/common/block/cpu/Kconfig
M src/soc/intel/common/block/cpu/Makefile.inc
A src/soc/intel/common/block/cpu/car/car.c
3 files changed, 71 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/92/34992/1
diff --git a/src/soc/intel/common/block/cpu/Kconfig b/src/soc/intel/common/block/cpu/Kconfig
index 8cc572d..0d1506b 100644
--- a/src/soc/intel/common/block/cpu/Kconfig
+++ b/src/soc/intel/common/block/cpu/Kconfig
@@ -66,3 +66,15 @@
help
This option allows FSP to make use of MP services PPI published by
coreboot to perform multiprocessor initialization.
+
+config MARK_DRAM_CACHE_WB
+ bool
+ default n
+ help
+ This option allows you to select how DRAM intermediate cache is set up.
+ Till discovering DRAM ranges, system will make use of CAR and CAR tear
+ down will handle by postcar/ramstage, that means entire postcar/ramstage
+ stage will execute from UC range. Intention here is to optimize the boot
+ flow hence enabling the caching for applicable DRAM ranges before CAR
+ tear down and setting up new DRAM based MTRR range. MTRR type WB
+ provides best optimization.
diff --git a/src/soc/intel/common/block/cpu/Makefile.inc b/src/soc/intel/common/block/cpu/Makefile.inc
index a6c4f37..63a2ac9 100644
--- a/src/soc/intel/common/block/cpu/Makefile.inc
+++ b/src/soc/intel/common/block/cpu/Makefile.inc
@@ -5,6 +5,7 @@
romstage-$(CONFIG_SOC_INTEL_COMMON_BLOCK_CAR) += car/exit_car.S
romstage-$(CONFIG_SOC_INTEL_COMMON_BLOCK_CPU) += cpulib.c
+romstage-$(CONFIG_MARK_DRAM_CACHE_WB) += car.c
postcar-$(CONFIG_SOC_INTEL_COMMON_BLOCK_CAR) += car/exit_car.S
postcar-$(CONFIG_FSP_CAR) += car/exit_car_fsp.S
diff --git a/src/soc/intel/common/block/cpu/car/car.c b/src/soc/intel/common/block/cpu/car/car.c
new file mode 100644
index 0000000..82d8e9a
--- /dev/null
+++ b/src/soc/intel/common/block/cpu/car/car.c
@@ -0,0 +1,58 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2019 Intel Corp.
+ *
+ * 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 <cbmem.h>
+#include <cpu/x86/cache.h>
+#include <program_loading.h>
+
+static inline int is_usable_dram_addr(uintptr_t addr)
+{
+ return (addr < (uintptr_t) cbmem_top());
+}
+
+/*
+ * CLFLUSH the impacted WB'ed cache lines before loading postcar/ramstage
+ * in order to avoid getting stuck while tearing down (invd) the CAR.
+ */
+static void flush_cache(uintptr_t start, size_t size)
+{
+ uintptr_t end;
+ uintptr_t addr;
+
+ end = start + (ALIGN_DOWN(size + 4096, 4096));
+ for (addr = start; addr < end; addr += 64)
+ clflush((void *)addr);
+}
+
+void platform_segment_loaded(uintptr_t start, size_t size, int flags)
+{
+ /* Bail out if this is not the final segment. */
+ if (!(flags & SEG_FINAL))
+ return;
+
+ char start_dram_check = is_usable_dram_addr(start);
+ char end_dram_check = is_usable_dram_addr(start + size - 1);
+
+ /*
+ * Bail out if loaded program segment does not lie in
+ * usable DRAM region.
+ */
+ if (!start_dram_check && !end_dram_check)
+ return;
+
+ flush_cache(start, size);
+}
--
To view, visit https://review.coreboot.org/c/coreboot/+/34992
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I591f21cb4199477af271f0dd6c073e1c11831bfd
Gerrit-Change-Number: 34992
Gerrit-PatchSet: 1
Gerrit-Owner: Subrata Banik <subrata.banik(a)intel.com>
Gerrit-Reviewer: Martin Roth <martinroth(a)google.com>
Gerrit-Reviewer: Patrick Georgi <pgeorgi(a)google.com>
Gerrit-Reviewer: Patrick Rudolph <siro(a)das-labor.org>
Gerrit-Reviewer: Subrata Banik <subrata.banik(a)intel.com>
Gerrit-MessageType: newchange