Arthur Heymans has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/32969
Change subject: soc/intel/baytrail: Use cpu/intel/car/romstage.c entry point
......................................................................
soc/intel/baytrail: Use cpu/intel/car/romstage.c entry point
This moves some boilerplate like setting up timestamps and entering
postcar to a common location.
Change-Id: I256b4149163245697fe1c2d4406bd6229a45b556
Signed-off-by: Arthur Heymans <arthur(a)aheymans.xyz>
---
M src/soc/intel/baytrail/romstage/Makefile.inc
M src/soc/intel/baytrail/romstage/romstage.c
2 files changed, 4 insertions(+), 22 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/69/32969/1
diff --git a/src/soc/intel/baytrail/romstage/Makefile.inc b/src/soc/intel/baytrail/romstage/Makefile.inc
index f1a3463..8f009bd 100644
--- a/src/soc/intel/baytrail/romstage/Makefile.inc
+++ b/src/soc/intel/baytrail/romstage/Makefile.inc
@@ -1,5 +1,6 @@
cpu_incs-y += $(src)/cpu/intel/car/non-evict/cache_as_ram.S
cpu_incs-y += $(obj)/fmap_config.h
+romstage-y += ../../../../cpu/intel/car/romstage.c
romstage-y += romstage.c
romstage-y += raminit.c
romstage-$(CONFIG_ENABLE_BUILTIN_COM1) += uart.c
diff --git a/src/soc/intel/baytrail/romstage/romstage.c b/src/soc/intel/baytrail/romstage/romstage.c
index cc3bcd9..2a530b4 100644
--- a/src/soc/intel/baytrail/romstage/romstage.c
+++ b/src/soc/intel/baytrail/romstage/romstage.c
@@ -21,6 +21,7 @@
#include <bootblock_common.h>
#include <console/console.h>
#include <cbmem.h>
+#include <cpu/intel/romstage.h>
#include <cpu/x86/mtrr.h>
#if CONFIG(EC_GOOGLE_CHROMEEC)
#include <ec/google/chromeec/ec.h>
@@ -49,8 +50,6 @@
* Because we can't use global variables the stack is used for allocations --
* thus the need to call back and forth. */
-static void platform_enter_postcar(void);
-
static void program_base_addresses(void)
{
uint32_t reg;
@@ -166,18 +165,12 @@
}
/* Entry from cache-as-ram.inc. */
-static void romstage_main(uint64_t tsc, uint32_t bist)
+void mainboard_romstage_entry(unsigned long bist)
{
struct mrc_params mrc_params;
struct chipset_power_state *ps;
int prev_sleep_state;
- /* Save initial timestamp from bootblock. */
- timestamp_init(tsc);
-
- /* Save romstage begin */
- timestamp_add_now(TS_START_ROMSTAGE);
-
program_base_addresses();
tco_disable();
@@ -215,25 +208,13 @@
timestamp_add_now(TS_AFTER_INITRAM);
romstage_handoff_init(prev_sleep_state == ACPI_S3);
-
- platform_enter_postcar();
-
- /* We don't return here */
-}
-
-/* This wrapper enables easy transition towards C_ENVIRONMENT_BOOTBLOCK,
- * keeping changes in cache_as_ram.S easy to manage.
- */
-asmlinkage void bootblock_c_entry_bist(uint64_t base_timestamp, uint32_t bist)
-{
- romstage_main(base_timestamp, bist);
}
#define ROMSTAGE_RAM_STACK_SIZE 0x5000
/* setup_stack_and_mtrrs() determines the stack to use after
* cache-as-ram is torn down as well as the MTRR settings to use. */
-static void platform_enter_postcar(void)
+void platform_enter_postcar(void)
{
struct postcar_frame pcf;
uintptr_t top_of_ram;
--
To view, visit https://review.coreboot.org/c/coreboot/+/32969
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I256b4149163245697fe1c2d4406bd6229a45b556
Gerrit-Change-Number: 32969
Gerrit-PatchSet: 1
Gerrit-Owner: Arthur Heymans <arthur(a)aheymans.xyz>
Gerrit-Reviewer: Arthur Heymans <arthur(a)aheymans.xyz>
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-MessageType: newchange
Arthur Heymans has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/31203
Change subject: cpu/intel/common: Compute the TSC tick freq based on FSB
......................................................................
cpu/intel/common: Compute the TSC tick freq based on FSB
This allows the cbmem utility to compute timestamps based on coreboot
tables without relying on other userspace components.
Change-Id: Ie87adec950dc51f4f873c0d852a325b3ff9b18bf
Signed-off-by: Arthur Heymans <arthur(a)aheymans.xyz>
---
M src/cpu/intel/common/fsb.c
1 file changed, 26 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/03/31203/1
diff --git a/src/cpu/intel/common/fsb.c b/src/cpu/intel/common/fsb.c
index 1f7c391..cf258bd 100644
--- a/src/cpu/intel/common/fsb.c
+++ b/src/cpu/intel/common/fsb.c
@@ -11,7 +11,9 @@
* GNU General Public License for more details.
*/
+#include <console/console.h>
#include <cpu/cpu.h>
+#include <cpu/x86/tsc.h>
#include <cpu/x86/msr.h>
#include <cpu/intel/speedstep.h>
#include <cpu/intel/fsb.h>
@@ -83,3 +85,27 @@
printk(BIOS_ERR, "FSB not supported or not found\n");
return -1;
}
+
+unsigned long tsc_freq_mhz(void)
+{
+ msr_t msr;
+ unsigned long multiplier;
+ struct cpuinfo_x86 c;
+
+ get_fms(&c, cpuid_eax(1));
+
+ msr = rdmsr(IA32_PLATFORM_ID);
+ multiplier = (msr.lo & SPEEDSTEP_RATIO_VALUE_MASK)
+ >> SPEEDSTEP_RATIO_SHIFT;
+ if ((c.x86 == 6 && c.x86_model == 0xe) || (c.x86 == 0xf)) {
+ /* Looks like Yonah CPUs don't have the frequency ratio in
+ IA32_PLATFORM_ID. Use IA32_PERF_STATUS instead, the reading
+ should be reliable as those CPUs don't have turbo mode. */
+ msr = rdmsr(IA32_PERF_STATUS);
+ multiplier = (msr.hi & SPEEDSTEP_RATIO_VALUE_MASK)
+ >> SPEEDSTEP_RATIO_SHIFT;
+ }
+
+ printk(BIOS_DEBUG, "CPU freq %ld\n", multiplier * get_ia32_fsb());
+ return multiplier * get_ia32_fsb();
+}
--
To view, visit https://review.coreboot.org/c/coreboot/+/31203
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: Ie87adec950dc51f4f873c0d852a325b3ff9b18bf
Gerrit-Change-Number: 31203
Gerrit-PatchSet: 1
Gerrit-Owner: Arthur Heymans <arthur(a)aheymans.xyz>
Gerrit-Reviewer: Arthur Heymans <arthur(a)aheymans.xyz>
Gerrit-Reviewer: Patrick Rudolph <siro(a)das-labor.org>
Gerrit-MessageType: newchange