IOC mediator: Set default boot wakeup reason for IOC mediator

Set default boot wakeup reason to avoid acrn-dm boot failed with
invalid acrn-dm boot parameter.

Signed-off-by: Yuan Liu <yuan1.liu@intel.com>
Reviewed-by: Yu Wang <yu1.wang@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Yuan Liu 2018-05-31 21:23:16 +08:00 committed by lijinxia
parent 14b2e1d395
commit d904202cfb
1 changed files with 12 additions and 3 deletions

View File

@ -1281,8 +1281,14 @@ ioc_parse(const char *opts)
snprintf(virtual_uart_path, sizeof(virtual_uart_path), "%s", param); snprintf(virtual_uart_path, sizeof(virtual_uart_path), "%s", param);
if (tmp != NULL) { if (tmp != NULL) {
tmp = strtok(NULL, ","); tmp = strtok(NULL, ",");
if (tmp != NULL) if (tmp != NULL) {
ioc_boot_reason = strtoul(tmp, 0, 0); ioc_boot_reason = strtoul(tmp, 0, 0);
/*
* Mask invalid bits of wakeup reason for IOC mediator
*/
ioc_boot_reason &= CBC_WK_RSN_ALL;
}
} }
free(param); free(param);
return 0; return 0;
@ -1302,9 +1308,12 @@ ioc_init(struct vmctx *ctx)
if (ioc_is_platform_supported() != 0) if (ioc_is_platform_supported() != 0)
goto ioc_err; goto ioc_err;
/* Check IOC boot reason */ /*
* Set default boot wakeup reason as ignition button active if met
* invalid parameter.
*/
if (ioc_boot_reason == 0) if (ioc_boot_reason == 0)
goto ioc_err; ioc_boot_reason = CBC_WK_RSN_BTN;
ioc = (struct ioc_dev *)calloc(1, sizeof(struct ioc_dev)); ioc = (struct ioc_dev *)calloc(1, sizeof(struct ioc_dev));
if (!ioc) if (!ioc)
goto ioc_err; goto ioc_err;