[coreboot-gerrit] Change in coreboot[master]: arch/x86: Add function to determine if we're currently runni...

Julius Werner (Code Review) gerrit at coreboot.org
Tue May 30 22:19:31 CEST 2017


Julius Werner has submitted this change and it was merged. ( https://review.coreboot.org/19787 )

Change subject: arch/x86: Add function to determine if we're currently running from CAR
......................................................................


arch/x86: Add function to determine if we're currently running from CAR

This patch adds a simple function that can be used to check if
CAR_GLOBALs are currently being read from CAR or from DRAM.

Change-Id: Ib7ad0896a691ef6e89e622b985417fedc43579c1
Signed-off-by: Julius Werner <jwerner at chromium.org>
Reviewed-on: https://review.coreboot.org/19787
Tested-by: build bot (Jenkins) <no-reply at coreboot.org>
Reviewed-by: Aaron Durbin <adurbin at chromium.org>
Reviewed-by: Philippe Mathieu-Daudé <philippe.mathieu.daude at gmail.com>
---
M src/arch/x86/include/arch/early_variables.h
M src/cpu/x86/car.c
2 files changed, 14 insertions(+), 0 deletions(-)

Approvals:
  Aaron Durbin: Looks good to me, approved
  Philippe Mathieu-Daudé: Looks good to me, but someone else must approve
  build bot (Jenkins): Verified



diff --git a/src/arch/x86/include/arch/early_variables.h b/src/arch/x86/include/arch/early_variables.h
index d0cfda7..2c6c539 100644
--- a/src/arch/x86/include/arch/early_variables.h
+++ b/src/arch/x86/include/arch/early_variables.h
@@ -44,12 +44,20 @@
 {
 	return var;
 }
+
+static inline int car_active(void)
+{
+	return 1;
+}
 #else
 /* Get the correct pointer for the CAR global variable. */
 void *car_get_var_ptr(void *var);
 
 /* Get and update a CAR_GLOBAL pointing elsewhere in car.global_data*/
 void *car_sync_var_ptr(void *var);
+
+/* Return 1 when currently running with globals in Cache-as-RAM, 0 otherwise. */
+int car_active(void);
 #endif /* ENV_VERSTAGE */
 
 /* Get and set a primitive type global variable. */
@@ -73,6 +81,7 @@
 #else
 #define CAR_GLOBAL
 static inline void *car_get_var_ptr(void *var) { return var; }
+static inline int car_active(void) { return 0; }
 #define car_get_var(var) (var)
 #define car_sync_var(var) (var)
 #define car_set_var(var, val)	(var) = (val)
diff --git a/src/cpu/x86/car.c b/src/cpu/x86/car.c
index 606a35e..1b02f8b 100644
--- a/src/cpu/x86/car.c
+++ b/src/cpu/x86/car.c
@@ -113,6 +113,11 @@
 	return mig_var;
 }
 
+int car_active(void)
+{
+	return !car_migrated;
+}
+
 static void do_car_migrate_variables(void)
 {
 	void *migrated_base;

-- 
To view, visit https://review.coreboot.org/19787
To unsubscribe, visit https://review.coreboot.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib7ad0896a691ef6e89e622b985417fedc43579c1
Gerrit-PatchSet: 3
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Owner: Julius Werner <jwerner at chromium.org>
Gerrit-Reviewer: Aaron Durbin <adurbin at chromium.org>
Gerrit-Reviewer: Furquan Shaikh <furquan at google.com>
Gerrit-Reviewer: Julius Werner <jwerner at chromium.org>
Gerrit-Reviewer: Kyösti Mälkki <kyosti.malkki at gmail.com>
Gerrit-Reviewer: Paul Menzel <paulepanter at users.sourceforge.net>
Gerrit-Reviewer: Philippe Mathieu-Daudé <philippe.mathieu.daude at gmail.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply at coreboot.org>



More information about the coreboot-gerrit mailing list