HV: remove DBG_LEVEL_PARSE

- It is meaningless to enable debug function in parse_hv_cmdline() because
the function run in very eary stage and uart has not been initialized at
that time, so remove this debug level definition;

- Rewrite parse_hv_cmdline() function to make it compliant with MISRA-C;

- Decouple uart16550 stuff from Init.c module and let console.c handle it;

Tracked-On: #4419

Signed-off-by: Victor Sun <victor.sun@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Victor Sun
2020-02-11 21:06:40 +08:00
committed by wenlingz
parent a46a7b3524
commit 708cae7c88
4 changed files with 15 additions and 30 deletions

View File

@@ -12,29 +12,19 @@
#include <logmsg.h>
#include <vboot.h>
#define DBG_LEVEL_PARSE 6
int32_t parse_hv_cmdline(void)
void parse_hv_cmdline(void)
{
const char *start;
const char *start = NULL;
const char *end = NULL;
struct multiboot_info *mbi = NULL;
if (boot_regs[0] != MULTIBOOT_INFO_MAGIC) {
return -EINVAL;
if ((boot_regs[0] == MULTIBOOT_INFO_MAGIC) && (boot_regs[1] != 0U)) {
struct multiboot_info *mbi = (struct multiboot_info *)(hpa2hva_early((uint64_t)boot_regs[1]));
if ((mbi->mi_flags & MULTIBOOT_INFO_HAS_CMDLINE) != 0U) {
start = (char *)hpa2hva_early((uint64_t)mbi->mi_cmdline);
}
}
mbi = (struct multiboot_info *)(hpa2hva_early((uint64_t)boot_regs[1]));
dev_dbg(DBG_LEVEL_PARSE, "Multiboot detected, flag=0x%x", mbi->mi_flags);
if ((mbi->mi_flags & MULTIBOOT_INFO_HAS_CMDLINE) == 0U) {
dev_dbg(DBG_LEVEL_PARSE, "no hv cmdline!");
return -EINVAL;
}
start = (char *)hpa2hva_early((uint64_t)mbi->mi_cmdline);
dev_dbg(DBG_LEVEL_PARSE, "hv cmdline: %s", start);
while ((start != NULL) && ((*start) != '\0')) {
while ((*start) == ' ')
start++;
@@ -50,5 +40,4 @@ int32_t parse_hv_cmdline(void)
}
}
return 0;
}

View File

@@ -26,6 +26,6 @@ uint64_t get_ap_trampoline_buf(void);
void *get_rsdp_ptr(void);
enum vboot_mode get_sos_boot_mode(void);
int32_t parse_hv_cmdline(void);
void parse_hv_cmdline(void);
#endif /* end of include guard: VBOOT_H */