diff --git a/hypervisor/arch/x86/init.c b/hypervisor/arch/x86/init.c index ff83b3744..e99e183c6 100644 --- a/hypervisor/arch/x86/init.c +++ b/hypervisor/arch/x86/init.c @@ -8,14 +8,11 @@ #include #include #include -#include -#include #include #include #include #include #include -#include #include #include @@ -32,12 +29,6 @@ /*TODO: move into debug module */ static void init_debug_pre(void) { - /* - * Enable UART as early as possible. - * Then we could use printf for debugging on early boot stage. - */ - uart16550_init(true); - /* Initialize console */ console_init(); @@ -88,7 +79,7 @@ void init_primary_pcpu(void) /* Clear BSS */ (void)memset(&ld_bss_start, 0U, (size_t)(&ld_bss_end - &ld_bss_start)); - (void)parse_hv_cmdline(); + parse_hv_cmdline(); init_debug_pre(); diff --git a/hypervisor/boot/cmdline.c b/hypervisor/boot/cmdline.c index 2689bbfe3..cd77a5d07 100644 --- a/hypervisor/boot/cmdline.c +++ b/hypervisor/boot/cmdline.c @@ -12,29 +12,19 @@ #include #include -#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; } diff --git a/hypervisor/boot/include/guest/vboot.h b/hypervisor/boot/include/guest/vboot.h index 784e91bb2..368ebe33c 100644 --- a/hypervisor/boot/include/guest/vboot.h +++ b/hypervisor/boot/include/guest/vboot.h @@ -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 */ diff --git a/hypervisor/debug/console.c b/hypervisor/debug/console.c index f439e487d..467a2981f 100644 --- a/hypervisor/debug/console.c +++ b/hypervisor/debug/console.c @@ -24,6 +24,11 @@ uint16_t console_vmid = ACRN_INVALID_VMID; void console_init(void) { + /* + * Enable UART as early as possible. + * Then we could use printf for debugging on early boot stage. + */ + uart16550_init(true); } void console_putc(const char *ch)