hv: pgtable: fix 'Use of function like macro'

Convert HPA2HVA, HVA2HPA, GPA2HVA and HVA2GPA to inline functions.

v1 -> v2:
 * Modify the following statement.
   rsdp = biosacpi_search_rsdp((char *)hpa2hva((uint64_t)(*addr << 4)),
                                                                0x400);
   Instead of "(uint64_t)(*addr << 4)", "(uint64_t)(*addr) << 4U" would
   be clearer.

Tracked-On: #861
Signed-off-by: Shiqing Gao <shiqing.gao@intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
This commit is contained in:
Shiqing Gao
2018-09-06 13:50:10 +08:00
committed by lijinxia
parent 6ee9321bd8
commit 97aeb7f4ff
24 changed files with 142 additions and 116 deletions

View File

@@ -73,7 +73,7 @@ int parse_hv_cmdline(void)
return -EINVAL;
}
mbi = (struct multiboot_info *)(HPA2HVA((uint64_t)boot_regs[1]));
mbi = (struct multiboot_info *)(hpa2hva((uint64_t)boot_regs[1]));
dev_dbg(ACRN_DBG_PARSE, "Multiboot detected, flag=0x%x", mbi->mi_flags);
if (!(mbi->mi_flags & MULTIBOOT_INFO_HAS_CMDLINE)) {
@@ -81,7 +81,7 @@ int parse_hv_cmdline(void)
return -EINVAL;
}
start = (char *)HPA2HVA((uint64_t)mbi->mi_cmdline);
start = (char *)hpa2hva((uint64_t)mbi->mi_cmdline);
dev_dbg(ACRN_DBG_PARSE, "hv cmdline: %s", start);
do {

View File

@@ -79,7 +79,7 @@ void *get_rsdp_from_uefi(void)
if (!efi_initialized)
efi_init();
return HPA2HVA(efi_ctx->rsdp);
return hpa2hva(efi_ctx->rsdp);
}
void *get_ap_trampoline_buf(void)
@@ -94,12 +94,13 @@ static void efi_init(void)
if (boot_regs[0] != MULTIBOOT_INFO_MAGIC)
ASSERT(0, "no multiboot info found");
mbi = (struct multiboot_info *)HPA2HVA(((uint64_t)(uint32_t)boot_regs[1]));
mbi = (struct multiboot_info *)
hpa2hva(((uint64_t)(uint32_t)boot_regs[1]));
if (!(mbi->mi_flags & MULTIBOOT_INFO_HAS_DRIVES))
ASSERT(0, "no multiboot drivers for uefi found");
efi_ctx = (struct boot_ctx *)HPA2HVA((uint64_t)mbi->mi_drives_addr);
efi_ctx = (struct boot_ctx *)hpa2hva((uint64_t)mbi->mi_drives_addr);
ASSERT(efi_ctx != NULL, "no uefi context found");
vm_sw_loader = uefi_sw_loader;