函数源码

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source File:arch\x86\include\asm\efi.h Create Date:2022-07-27 08:39:00
首页 Copyright©Brick

153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
#ifdef CONFIG_EFI
 
static inline bool efi_is_native(void)
{
    return IS_ENABLED(CONFIG_X86_64) == efi_enabled(EFI_64BIT);
}
 
static inline bool efi_runtime_supported(void)
{
    if (efi_is_native())
        return true;
 
    if (IS_ENABLED(CONFIG_EFI_MIXED) && !efi_enabled(EFI_OLD_MEMMAP))
        return true;
 
    return false;
}
 
extern void parse_efi_setup(u64 phys_addr, u32 data_len);
 
extern void efifb_setup_from_dmi(struct screen_info *si, const char *opt);
 
#ifdef CONFIG_EFI_MIXED
extern void efi_thunk_runtime_setup(void);
extern efi_status_t efi_thunk_set_virtual_address_map(
    void *phys_set_virtual_address_map,
    unsigned long memory_map_size,
    unsigned long descriptor_size,
    u32 descriptor_version,
    efi_memory_desc_t *virtual_map);
#else
static inline void efi_thunk_runtime_setup(void) {}
static inline efi_status_t efi_thunk_set_virtual_address_map(
    void *phys_set_virtual_address_map,
    unsigned long memory_map_size,
    unsigned long descriptor_size,
    u32 descriptor_version,
    efi_memory_desc_t *virtual_map)
{
    return EFI_SUCCESS;
}
#endif /* CONFIG_EFI_MIXED */
 
 
/* arch specific definitions used by the stub code */
 
struct efi_config {
    u64 image_handle;
    u64 table;
    u64 runtime_services;
    u64 boot_services;
    u64 text_output;
    efi_status_t (*call)(unsigned long, ...);
    bool is64;
} __packed;
 
__pure const struct efi_config *__efi_early(void);
 
static inline bool efi_is_64bit(void)
{
    if (!IS_ENABLED(CONFIG_X86_64))
        return false;
 
    if (!IS_ENABLED(CONFIG_EFI_MIXED))
        return true;
 
    return __efi_early()->is64;
}
 
#define efi_table_attr(table, attr, instance)               \
    (efi_is_64bit() ?                       \
        ((table##_64_t *)(unsigned long)instance)->attr :   \
        ((table##_32_t *)(unsigned long)instance)->attr)
 
#define efi_call_proto(protocol, f, instance, ...)          \
    __efi_early()->call(efi_table_attr(protocol, f, instance),  \
        instance, ##__VA_ARGS__)
 
#define efi_call_early(f, ...)                      \
    __efi_early()->call(efi_table_attr(efi_boot_services, f,    \
        __efi_early()->boot_services), __VA_ARGS__)
 
#define __efi_call_early(f, ...)                    \
    __efi_early()->call((unsigned long)f, __VA_ARGS__);
 
#define efi_call_runtime(f, ...)                    \
    __efi_early()->call(efi_table_attr(efi_runtime_services, f, \
        __efi_early()->runtime_services), __VA_ARGS__)
 
extern bool efi_reboot_required(void);
extern bool efi_is_table_address(unsigned long phys_addr);
 
extern void efi_find_mirror(void);
extern void efi_reserve_boot_services(void);
#else
static inline void parse_efi_setup(u64 phys_addr, u32 data_len) {}