timestamps: Use stash before CBMEM is usable

Change-Id: I9e927abdb1d7d9c233de5620a9a65b419e803ebf
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: http://review.coreboot.org/3909
Tested-by: build bot (Jenkins)
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Aaron Durbin <adurbin@google.com>
diff --git a/src/lib/hardwaremain.c b/src/lib/hardwaremain.c
index 898e910..dd97196 100644
--- a/src/lib/hardwaremain.c
+++ b/src/lib/hardwaremain.c
@@ -126,7 +126,7 @@
 
 static boot_state_t bs_dev_init_chips(void *arg)
 {
-	timestamp_stash(TS_DEVICE_ENUMERATE);
+	timestamp_add_now(TS_DEVICE_ENUMERATE);
 
 	/* Initialize chips early, they might disable unused devices. */
 	dev_initialize_chips();
@@ -145,7 +145,7 @@
 
 static boot_state_t bs_dev_resources(void *arg)
 {
-	timestamp_stash(TS_DEVICE_CONFIGURE);
+	timestamp_add_now(TS_DEVICE_CONFIGURE);
 	/* Now compute and assign the bus resources. */
 	dev_configure();
 	post_code(POST_DEVICE_CONFIGURATION_COMPLETE);
@@ -155,7 +155,7 @@
 
 static boot_state_t bs_dev_enable(void *arg)
 {
-	timestamp_stash(TS_DEVICE_ENABLE);
+	timestamp_add_now(TS_DEVICE_ENABLE);
 	/* Now actually enable devices on the bus */
 	dev_enable();
 	post_code(POST_DEVICES_ENABLED);
@@ -165,7 +165,7 @@
 
 static boot_state_t bs_dev_init(void *arg)
 {
-	timestamp_stash(TS_DEVICE_INITIALIZE);
+	timestamp_add_now(TS_DEVICE_INITIALIZE);
 	/* And of course initialize devices on the bus */
 	dev_initialize();
 	post_code(POST_DEVICES_INITIALIZED);
@@ -175,7 +175,7 @@
 
 static boot_state_t bs_post_device(void *arg)
 {
-	timestamp_stash(TS_DEVICE_DONE);
+	timestamp_add_now(TS_DEVICE_DONE);
 
 	timestamp_sync();
 
@@ -446,7 +446,10 @@
 
 void main(void)
 {
-	timestamp_stash(TS_START_RAMSTAGE);
+	/* Record current time, try to locate timestamps in CBMEM. */
+	timestamp_init(rdtsc());
+
+	timestamp_add_now(TS_START_RAMSTAGE);
 	post_code(POST_ENTRY_RAMSTAGE);
 
 	/* console_init() MUST PRECEDE ALL printk()! */