HV: Replace printf with pr_acrnlog after logmsg init

There are some massages which is not fatal error but should to print
to serial and sbuf(hvlog) at the same time. pr_fatal is for fatal error
massages and it is not good choice for the situation above.

Introduce a new API pr_acrnlog to deal with the situation. And replace the
following printf with pr_acrnlog for massages should be print to sbuf and
serial. Then developers can get those massages on serial and BTM(Boot Time
Measurement) can use acrnlog to get those massages from sbuf.

BTM refers to Boot Time Measurement which will read acrnlog file to get
timestamps of steps we want.

Signed-off-by: Kaige Fu <kaige.fu@intel.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
This commit is contained in:
Kaige Fu 2018-05-23 11:34:08 +08:00 committed by lijinxia
parent 9af38e16e5
commit 80a79fed39
4 changed files with 20 additions and 13 deletions

View File

@ -239,7 +239,7 @@ static int hardware_detect_support(void)
if (ret)
return ret;
printf("hardware support HV\n");
pr_acrnlog("hardware support HV");
return 0;
}
@ -484,20 +484,20 @@ void bsp_boot_init(void)
LOG_DESTINATION);
if (HV_RC_VERSION)
printf("HV version %d.%d-rc%d-%s-%s %s build by %s, start time %lluus\r\n",
pr_acrnlog("HV version %d.%d-rc%d-%s-%s %s build by %s, start time %lluus",
HV_MAJOR_VERSION, HV_MINOR_VERSION, HV_RC_VERSION,
HV_BUILD_TIME, HV_BUILD_VERSION, HV_BUILD_TYPE,
HV_BUILD_USER, TICKS_TO_US(start_tsc));
else
printf("HV version %d.%d-%s-%s %s build by %s, start time %lluus\r\n",
pr_acrnlog("HV version %d.%d-%s-%s %s build by %s, start time %lluus",
HV_MAJOR_VERSION, HV_MINOR_VERSION,
HV_BUILD_TIME, HV_BUILD_VERSION, HV_BUILD_TYPE,
HV_BUILD_USER, TICKS_TO_US(start_tsc));
printf("API version %d.%d\r\n",
pr_acrnlog("API version %d.%d",
HV_API_MAJOR_VERSION, HV_API_MINOR_VERSION);
printf("Detect processor: %s\n", boot_cpu_data.model_name);
pr_acrnlog("Detect processor: %s", boot_cpu_data.model_name);
pr_dbg("Core %d is up", CPU_BOOT_ID);

View File

@ -39,8 +39,8 @@
#define MALLOC_ALIGN 16
#define NUM_ALLOC_PAGES 4096
#define HEAP_SIZE 0x100000
#define CONSOLE_LOGLEVEL_DEFAULT 2
#define MEM_LOGLEVEL_DEFAULT 4
#define CONSOLE_LOGLEVEL_DEFAULT 3
#define MEM_LOGLEVEL_DEFAULT 5
#define CONFIG_LOW_RAM_START 0x00001000
#define CONFIG_LOW_RAM_SIZE 0x000CF000
#define CONFIG_RAM_START 0x6E000000

View File

@ -39,8 +39,8 @@
#define MALLOC_ALIGN 16
#define NUM_ALLOC_PAGES 4096
#define HEAP_SIZE 0x100000
#define CONSOLE_LOGLEVEL_DEFAULT 2
#define MEM_LOGLEVEL_DEFAULT 4
#define CONSOLE_LOGLEVEL_DEFAULT 3
#define MEM_LOGLEVEL_DEFAULT 5
#define CONFIG_LOW_RAM_START 0x00008000
#define CONFIG_LOW_RAM_SIZE 0x00010000
#define CONFIG_RAM_START 0x20000000

View File

@ -33,10 +33,12 @@
/* Logging severity levels */
#define LOG_FATAL 1
#define LOG_ERROR 2
#define LOG_WARNING 3
#define LOG_INFO 4
#define LOG_DEBUG 5
/* For msg should be write to console and sbuf meanwhile but not fatal error */
#define LOG_ACRN 2
#define LOG_ERROR 3
#define LOG_WARNING 4
#define LOG_INFO 5
#define LOG_DEBUG 6
/* Logging flags */
#define LOG_FLAG_STDOUT 0x00000001
@ -77,6 +79,11 @@ static inline void print_logmsg_buffer(__unused uint32_t cpu_id)
do_logmsg(LOG_FATAL, pr_prefix __VA_ARGS__); \
} while (0)
#define pr_acrnlog(...) \
do { \
do_logmsg(LOG_ACRN, pr_prefix __VA_ARGS__); \
} while (0)
#define pr_err(...) \
do { \
do_logmsg(LOG_ERROR, pr_prefix __VA_ARGS__); \