Clean up MISRA C violation
clean up a few MISRA C violations that can be fixed by code change in vboot files Tracked-On: #861 Signed-off-by: Jason Chen CJ <jason.cj.chen@intel.com>
This commit is contained in:
parent
d364d352f8
commit
7494ed2775
|
@ -271,7 +271,7 @@ switch_to_guest_mode(EFI_HANDLE image, EFI_PHYSICAL_ADDRESS hv_hpa)
|
|||
if (addr < 4096)
|
||||
Print(L"Warning: CPU trampoline code buf occupied zero-page\n");
|
||||
|
||||
efi_ctx->ap_trampoline_buf = (void *)addr;
|
||||
efi_ctx->ap_trampoline_buf = addr;
|
||||
|
||||
config_table = sys_table->ConfigurationTable;
|
||||
|
||||
|
|
|
@ -26,13 +26,13 @@ static void init_depri_boot(void)
|
|||
struct multiboot_info *mbi = NULL;
|
||||
|
||||
if (!depri_initialized) {
|
||||
parse_hv_cmdline();
|
||||
(void)parse_hv_cmdline();
|
||||
|
||||
mbi = (struct multiboot_info *) hpa2hva(((uint64_t)(uint32_t)boot_regs[1]));
|
||||
if ((mbi->mi_flags & MULTIBOOT_INFO_HAS_DRIVES) == 0U) {
|
||||
if ((mbi == NULL) || ((mbi->mi_flags & MULTIBOOT_INFO_HAS_DRIVES) == 0U)) {
|
||||
pr_err("no multiboot drivers for depri_boot found");
|
||||
} else {
|
||||
memcpy_s(&depri_boot_ctx, sizeof(struct depri_boot_context),
|
||||
(void)memcpy_s(&depri_boot_ctx, sizeof(struct depri_boot_context),
|
||||
hpa2hva((uint64_t)mbi->mi_drives_addr),
|
||||
sizeof(struct depri_boot_context));
|
||||
save_lapic(&depri_boot_lapic_regs);
|
||||
|
@ -55,7 +55,7 @@ const struct lapic_regs *get_depri_boot_lapic_regs(void)
|
|||
|
||||
static uint64_t get_depri_boot_ap_trampoline(void)
|
||||
{
|
||||
return (uint64_t)(depri_boot_ctx.ap_trampoline_buf);
|
||||
return depri_boot_ctx.ap_trampoline_buf;
|
||||
}
|
||||
|
||||
static void* get_depri_boot_rsdp(void)
|
||||
|
@ -63,7 +63,7 @@ static void* get_depri_boot_rsdp(void)
|
|||
return hpa2hva((uint64_t)(depri_boot_ctx.rsdp));
|
||||
}
|
||||
|
||||
static void depri_boot_spurious_handler(int32_t vector)
|
||||
static void depri_boot_spurious_handler(uint32_t vector)
|
||||
{
|
||||
if (get_pcpu_id() == BOOT_CPU_ID) {
|
||||
struct acrn_vcpu *vcpu = per_cpu(vcpu, BOOT_CPU_ID);
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include <vboot.h>
|
||||
#include <direct_boot.h>
|
||||
#include <deprivilege_boot.h>
|
||||
#include <logmsg.h>
|
||||
|
||||
#define BOOTLOADER_NUM 4U
|
||||
#define BOOTLOADER_NAME_SIZE 20U
|
||||
|
@ -42,18 +43,22 @@ void init_vboot_operations(void)
|
|||
};
|
||||
|
||||
mbi = (struct multiboot_info *)hpa2hva((uint64_t)boot_regs[1]);
|
||||
for (i = 0U; i < BOOTLOADER_NUM; i++) {
|
||||
if (strncmp(hpa2hva(mbi->mi_loader_name), vboot_bootloader_maps[i].bootloader_name,
|
||||
strnlen_s(vboot_bootloader_maps[i].bootloader_name, BOOTLOADER_NAME_SIZE)) == 0) {
|
||||
/* Only support two vboot mode */
|
||||
if (vboot_bootloader_maps[i].mode == DEPRI_BOOT_MODE) {
|
||||
vboot_ops = get_deprivilege_boot_ops();
|
||||
sos_boot_mode = DEPRI_BOOT_MODE;
|
||||
} else {
|
||||
vboot_ops = get_direct_boot_ops();
|
||||
sos_boot_mode = DIRECT_BOOT_MODE;
|
||||
if (mbi == NULL) {
|
||||
panic("No multiboot info");
|
||||
} else {
|
||||
for (i = 0U; i < BOOTLOADER_NUM; i++) {
|
||||
if (strncmp(hpa2hva(mbi->mi_loader_name), vboot_bootloader_maps[i].bootloader_name,
|
||||
strnlen_s(vboot_bootloader_maps[i].bootloader_name, BOOTLOADER_NAME_SIZE)) == 0) {
|
||||
/* Only support two vboot mode */
|
||||
if (vboot_bootloader_maps[i].mode == DEPRI_BOOT_MODE) {
|
||||
vboot_ops = get_deprivilege_boot_ops();
|
||||
sos_boot_mode = DEPRI_BOOT_MODE;
|
||||
} else {
|
||||
vboot_ops = get_direct_boot_ops();
|
||||
sos_boot_mode = DIRECT_BOOT_MODE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
struct depri_boot_context {
|
||||
struct acrn_vcpu_regs vcpu_regs;
|
||||
void *rsdp;
|
||||
void *ap_trampoline_buf;
|
||||
uint64_t ap_trampoline_buf;
|
||||
} __packed;
|
||||
|
||||
const struct depri_boot_context *get_depri_boot_ctx(void);
|
||||
|
|
Loading…
Reference in New Issue