x86/efi: Implement a __efi_call_virt macro
For i386, all the EFI system runtime services functions return efi_status_t except efi_reset_system_system. Therefore, not all functions can be covered by the same macro in case the macro needs to do more than calling the function (i.e., return a value). The purpose of the __efi_call_virt macro is to be used when no return value is expected. For x86_64, this macro would not be needed as all the runtime services return u64. However, the same code is used for both x86_64 and i386. Thus, the macro __efi_call_virt is also defined to not break compilation. Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com> Cc: Borislav Petkov <bp@suse.de> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
This commit is contained in:
parent
c6b4069192
commit
982e239cd2
2 changed files with 12 additions and 2 deletions
|
@ -31,9 +31,13 @@ extern unsigned long asmlinkage efi_call_phys(void *, ...);
|
||||||
* Wrap all the virtual calls in a way that forces the parameters on the stack.
|
* Wrap all the virtual calls in a way that forces the parameters on the stack.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* Use this macro if your virtual returns a non-void value */
|
||||||
#define efi_call_virt(f, args...) \
|
#define efi_call_virt(f, args...) \
|
||||||
((efi_##f##_t __attribute__((regparm(0)))*)efi.systab->runtime->f)(args)
|
((efi_##f##_t __attribute__((regparm(0)))*)efi.systab->runtime->f)(args)
|
||||||
|
|
||||||
|
/* Use this macro if your virtual call does not return any value */
|
||||||
|
#define __efi_call_virt(f, args...) efi_call_virt(f, args)
|
||||||
|
|
||||||
#define efi_ioremap(addr, size, type, attr) ioremap_cache(addr, size)
|
#define efi_ioremap(addr, size, type, attr) ioremap_cache(addr, size)
|
||||||
|
|
||||||
#else /* !CONFIG_X86_32 */
|
#else /* !CONFIG_X86_32 */
|
||||||
|
@ -55,6 +59,12 @@ extern u64 asmlinkage efi_call(void *fp, ...);
|
||||||
__s; \
|
__s; \
|
||||||
})
|
})
|
||||||
|
|
||||||
|
/*
|
||||||
|
* All X86_64 virt calls return non-void values. Thus, use non-void call for
|
||||||
|
* virt calls that would be void on X86_32.
|
||||||
|
*/
|
||||||
|
#define __efi_call_virt(f, args...) efi_call_virt(f, args)
|
||||||
|
|
||||||
extern void __iomem *efi_ioremap(unsigned long addr, unsigned long size,
|
extern void __iomem *efi_ioremap(unsigned long addr, unsigned long size,
|
||||||
u32 type, u64 attribute);
|
u32 type, u64 attribute);
|
||||||
|
|
||||||
|
|
|
@ -202,8 +202,8 @@ static void virt_efi_reset_system(int reset_type,
|
||||||
unsigned long data_size,
|
unsigned long data_size,
|
||||||
efi_char16_t *data)
|
efi_char16_t *data)
|
||||||
{
|
{
|
||||||
efi_call_virt(reset_system, reset_type, status,
|
__efi_call_virt(reset_system, reset_type, status,
|
||||||
data_size, data);
|
data_size, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static efi_status_t virt_efi_update_capsule(efi_capsule_header_t **capsules,
|
static efi_status_t virt_efi_update_capsule(efi_capsule_header_t **capsules,
|
||||||
|
|
Loading…
Add table
Reference in a new issue