Rationalize console log output

Fix the following issues with the console log output:

* Make sure the welcome string is the first thing in the log output
(during normal boot).
* Prefix each message with the BL image name so it's clear which
BL the output is coming from.
* Ensure all output is wrapped in one of the log output macros so it can
be easily compiled out if necessary. Change some of the INFO() messages
to VERBOSE(), especially in the TSP.
* Create some extra NOTICE() and INFO() messages during cold boot.
* Remove all usage of \r in log output.

Fixes ARM-software/tf-issues#231

Change-Id: Ib24f7acb36ce64bbba549f204b9cde2dbb46c8a3
diff --git a/bl32/tsp/tsp_main.c b/bl32/tsp/tsp_main.c
index b2850e9..982bab2 100644
--- a/bl32/tsp/tsp_main.c
+++ b/bl32/tsp/tsp_main.c
@@ -105,6 +105,12 @@
  ******************************************************************************/
 uint64_t tsp_main(void)
 {
+	NOTICE("TSP: %s\n", version_string);
+	NOTICE("TSP: %s\n", build_message);
+	INFO("TSP: Total memory base : 0x%x\n", (unsigned long)BL32_TOTAL_BASE);
+	INFO("TSP: Total memory size : 0x%x bytes\n",
+			 (unsigned long)(BL32_TOTAL_LIMIT - BL32_TOTAL_BASE));
+
 	uint64_t mpidr = read_mpidr();
 	uint32_t linear_id = platform_get_core_pos(mpidr);
 
@@ -119,18 +125,14 @@
 	tsp_stats[linear_id].eret_count++;
 	tsp_stats[linear_id].cpu_on_count++;
 
+#if LOG_LEVEL >= LOG_LEVEL_INFO
 	spin_lock(&console_lock);
-	tf_printf("TSP %s\n", version_string);
-	tf_printf("TSP %s\n", build_message);
-	INFO("Total memory base : 0x%x\n", (unsigned long)BL32_TOTAL_BASE);
-	INFO("Total memory size : 0x%x bytes\n",
-			 (unsigned long)(BL32_TOTAL_LIMIT - BL32_TOTAL_BASE));
-	INFO("cpu 0x%x: %d smcs, %d erets %d cpu on requests\n", mpidr,
+	INFO("TSP: cpu 0x%x: %d smcs, %d erets %d cpu on requests\n", mpidr,
 	     tsp_stats[linear_id].smc_count,
 	     tsp_stats[linear_id].eret_count,
 	     tsp_stats[linear_id].cpu_on_count);
 	spin_unlock(&console_lock);
-
+#endif
 	return (uint64_t) &tsp_vector_table;
 }
 
@@ -152,14 +154,15 @@
 	tsp_stats[linear_id].eret_count++;
 	tsp_stats[linear_id].cpu_on_count++;
 
+#if LOG_LEVEL >= LOG_LEVEL_INFO
 	spin_lock(&console_lock);
-	tf_printf("SP: cpu 0x%x turned on\n\r", mpidr);
-	INFO("cpu 0x%x: %d smcs, %d erets %d cpu on requests\n", mpidr,
-	     tsp_stats[linear_id].smc_count,
-	     tsp_stats[linear_id].eret_count,
-	     tsp_stats[linear_id].cpu_on_count);
+	INFO("TSP: cpu 0x%x turned on\n", mpidr);
+	INFO("TSP: cpu 0x%x: %d smcs, %d erets %d cpu on requests\n", mpidr,
+		tsp_stats[linear_id].smc_count,
+		tsp_stats[linear_id].eret_count,
+		tsp_stats[linear_id].cpu_on_count);
 	spin_unlock(&console_lock);
-
+#endif
 	/* Indicate to the SPD that we have completed turned ourselves on */
 	return set_smc_args(TSP_ON_DONE, 0, 0, 0, 0, 0, 0, 0);
 }
@@ -192,14 +195,15 @@
 	tsp_stats[linear_id].eret_count++;
 	tsp_stats[linear_id].cpu_off_count++;
 
+#if LOG_LEVEL >= LOG_LEVEL_INFO
 	spin_lock(&console_lock);
-	tf_printf("SP: cpu 0x%x off request\n\r", mpidr);
-	INFO("cpu 0x%x: %d smcs, %d erets %d cpu off requests\n", mpidr,
-	     tsp_stats[linear_id].smc_count,
-	     tsp_stats[linear_id].eret_count,
-	     tsp_stats[linear_id].cpu_off_count);
+	INFO("TSP: cpu 0x%x off request\n", mpidr);
+	INFO("TSP: cpu 0x%x: %d smcs, %d erets %d cpu off requests\n", mpidr,
+		tsp_stats[linear_id].smc_count,
+		tsp_stats[linear_id].eret_count,
+		tsp_stats[linear_id].cpu_off_count);
 	spin_unlock(&console_lock);
-
+#endif
 
 	/* Indicate to the SPD that we have completed this request */
 	return set_smc_args(TSP_OFF_DONE, 0, 0, 0, 0, 0, 0, 0);
@@ -234,14 +238,17 @@
 	tsp_stats[linear_id].eret_count++;
 	tsp_stats[linear_id].cpu_suspend_count++;
 
+#if LOG_LEVEL >= LOG_LEVEL_INFO
 	spin_lock(&console_lock);
-	tf_printf("SP: cpu 0x%x suspend request. power state: 0x%x\n\r",
-	       mpidr, power_state);
-	INFO("cpu 0x%x: %d smcs, %d erets %d cpu suspend requests\n", mpidr,
-	     tsp_stats[linear_id].smc_count,
-	     tsp_stats[linear_id].eret_count,
-	     tsp_stats[linear_id].cpu_suspend_count);
+	INFO("TSP: cpu 0x%x suspend request. power state: 0x%x\n",
+		mpidr, power_state);
+	INFO("TSP: cpu 0x%x: %d smcs, %d erets %d cpu suspend requests\n",
+		mpidr,
+		tsp_stats[linear_id].smc_count,
+		tsp_stats[linear_id].eret_count,
+		tsp_stats[linear_id].cpu_suspend_count);
 	spin_unlock(&console_lock);
+#endif
 
 	/* Indicate to the SPD that we have completed this request */
 	return set_smc_args(TSP_SUSPEND_DONE, 0, 0, 0, 0, 0, 0, 0);
@@ -272,15 +279,17 @@
 	tsp_stats[linear_id].eret_count++;
 	tsp_stats[linear_id].cpu_resume_count++;
 
+#if LOG_LEVEL >= LOG_LEVEL_INFO
 	spin_lock(&console_lock);
-	tf_printf("SP: cpu 0x%x resumed. suspend level %d \n\r",
-	       mpidr, suspend_level);
-	INFO("cpu 0x%x: %d smcs, %d erets %d cpu suspend requests\n", mpidr,
-	     tsp_stats[linear_id].smc_count,
-	     tsp_stats[linear_id].eret_count,
-	     tsp_stats[linear_id].cpu_suspend_count);
+	INFO("TSP: cpu 0x%x resumed. suspend level %d\n",
+		mpidr, suspend_level);
+	INFO("TSP: cpu 0x%x: %d smcs, %d erets %d cpu suspend requests\n",
+		mpidr,
+		tsp_stats[linear_id].smc_count,
+		tsp_stats[linear_id].eret_count,
+		tsp_stats[linear_id].cpu_suspend_count);
 	spin_unlock(&console_lock);
-
+#endif
 	/* Indicate to the SPD that we have completed this request */
 	return set_smc_args(TSP_RESUME_DONE, 0, 0, 0, 0, 0, 0, 0);
 }
@@ -304,18 +313,17 @@
 	uint64_t service_args[2];
 	uint64_t mpidr = read_mpidr();
 	uint32_t linear_id = platform_get_core_pos(mpidr);
-	const char *smc_type;
 
 	/* Update this cpu's statistics */
 	tsp_stats[linear_id].smc_count++;
 	tsp_stats[linear_id].eret_count++;
 
-	smc_type = ((func >> 31) & 1) == 1 ? "fast" : "standard";
-
-	tf_printf("SP: cpu 0x%x received %s smc 0x%x\n", read_mpidr(), smc_type, func);
-	INFO("cpu 0x%x: %d smcs, %d erets\n", mpidr,
-	     tsp_stats[linear_id].smc_count,
-	     tsp_stats[linear_id].eret_count);
+	INFO("TSP: cpu 0x%x received %s smc 0x%x\n", read_mpidr(),
+		((func >> 31) & 1) == 1 ? "fast" : "standard",
+		func);
+	INFO("TSP: cpu 0x%x: %d smcs, %d erets\n", mpidr,
+		tsp_stats[linear_id].smc_count,
+		tsp_stats[linear_id].eret_count);
 
 	/* Render secure services and obtain results here */
 	results[0] = arg1;