efi.h (4da87c51705815fe1fbd41cc61640bb80da5bc54) efi.h (44f155b4b07b8293472c9797d5b39839b91041ca)
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _ASM_X86_EFI_H
3#define _ASM_X86_EFI_H
4
5#include <asm/fpu/api.h>
6#include <asm/processor-flags.h>
7#include <asm/tlb.h>
8#include <asm/nospec-branch.h>

--- 32 unchanged lines hidden (view full) ---

41 * impossible to calculate the exact number of arguments beyond some
42 * pre-defined limit. The maximum number of arguments currently supported by
43 * any of the thunks is 7, so this is good enough for now and can be extended
44 * in the obvious way if we ever need more.
45 */
46
47#define __efi_nargs(...) __efi_nargs_(__VA_ARGS__)
48#define __efi_nargs_(...) __efi_nargs__(0, ##__VA_ARGS__, \
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _ASM_X86_EFI_H
3#define _ASM_X86_EFI_H
4
5#include <asm/fpu/api.h>
6#include <asm/processor-flags.h>
7#include <asm/tlb.h>
8#include <asm/nospec-branch.h>

--- 32 unchanged lines hidden (view full) ---

41 * impossible to calculate the exact number of arguments beyond some
42 * pre-defined limit. The maximum number of arguments currently supported by
43 * any of the thunks is 7, so this is good enough for now and can be extended
44 * in the obvious way if we ever need more.
45 */
46
47#define __efi_nargs(...) __efi_nargs_(__VA_ARGS__)
48#define __efi_nargs_(...) __efi_nargs__(0, ##__VA_ARGS__, \
49 __efi_arg_sentinel(9), __efi_arg_sentinel(8), \
49 __efi_arg_sentinel(7), __efi_arg_sentinel(6), \
50 __efi_arg_sentinel(5), __efi_arg_sentinel(4), \
51 __efi_arg_sentinel(3), __efi_arg_sentinel(2), \
52 __efi_arg_sentinel(1), __efi_arg_sentinel(0))
50 __efi_arg_sentinel(7), __efi_arg_sentinel(6), \
51 __efi_arg_sentinel(5), __efi_arg_sentinel(4), \
52 __efi_arg_sentinel(3), __efi_arg_sentinel(2), \
53 __efi_arg_sentinel(1), __efi_arg_sentinel(0))
53#define __efi_nargs__(_0, _1, _2, _3, _4, _5, _6, _7, n, ...) \
54#define __efi_nargs__(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, n, ...) \
54 __take_second_arg(n, \
55 __take_second_arg(n, \
55 ({ BUILD_BUG_ON_MSG(1, "__efi_nargs limit exceeded"); 8; }))
56 ({ BUILD_BUG_ON_MSG(1, "__efi_nargs limit exceeded"); 10; }))
56#define __efi_arg_sentinel(n) , n
57
58/*
59 * __efi_nargs_check(f, n, ...) will cause a BUILD_BUG if the ellipsis
60 * represents more than n arguments.
61 */
62
63#define __efi_nargs_check(f, n, ...) \

--- 107 unchanged lines hidden (view full) ---

171};
172
173extern u64 efi_setup;
174
175#ifdef CONFIG_EFI
176extern efi_status_t __efi64_thunk(u32, ...);
177
178#define efi64_thunk(...) ({ \
57#define __efi_arg_sentinel(n) , n
58
59/*
60 * __efi_nargs_check(f, n, ...) will cause a BUILD_BUG if the ellipsis
61 * represents more than n arguments.
62 */
63
64#define __efi_nargs_check(f, n, ...) \

--- 107 unchanged lines hidden (view full) ---

172};
173
174extern u64 efi_setup;
175
176#ifdef CONFIG_EFI
177extern efi_status_t __efi64_thunk(u32, ...);
178
179#define efi64_thunk(...) ({ \
179 __efi_nargs_check(efi64_thunk, 6, __VA_ARGS__); \
180 __efi64_thunk(__VA_ARGS__); \
180 u64 __pad[3]; /* must have space for 3 args on the stack */ \
181 __efi_nargs_check(efi64_thunk, 9, __VA_ARGS__); \
182 __efi64_thunk(__VA_ARGS__, __pad); \
181})
182
183static inline bool efi_is_mixed(void)
184{
185 if (!IS_ENABLED(CONFIG_EFI_MIXED))
186 return false;
187 return IS_ENABLED(CONFIG_X86_64) && !efi_enabled(EFI_64BIT);
188}

--- 210 unchanged lines hidden ---
183})
184
185static inline bool efi_is_mixed(void)
186{
187 if (!IS_ENABLED(CONFIG_EFI_MIXED))
188 return false;
189 return IS_ENABLED(CONFIG_X86_64) && !efi_enabled(EFI_64BIT);
190}

--- 210 unchanged lines hidden ---