blob: 5f273b43d7047f8fc8df4d4f5349bf0604eb60f2 [file] [log] [blame]
Ard Biesheuvelda58fb62015-09-24 13:49:52 -07001/*
2 * Copyright (C) 2015 Linaro Ltd <ard.biesheuvel@linaro.org>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#ifndef __ASM_ARM_EFI_H
10#define __ASM_ARM_EFI_H
11
12#include <asm/cacheflush.h>
13#include <asm/cachetype.h>
14#include <asm/early_ioremap.h>
15#include <asm/fixmap.h>
16#include <asm/highmem.h>
17#include <asm/mach/map.h>
18#include <asm/mmu_context.h>
19#include <asm/pgtable.h>
20
21#ifdef CONFIG_EFI
22void efi_init(void);
23
24int efi_create_mapping(struct mm_struct *mm, efi_memory_desc_t *md);
Ard Biesheuvel9fc68b72016-04-25 21:06:42 +010025int efi_set_mapping_permissions(struct mm_struct *mm, efi_memory_desc_t *md);
Ard Biesheuvelda58fb62015-09-24 13:49:52 -070026
Mark Rutland819fc122016-04-25 21:07:05 +010027#define arch_efi_call_virt_setup() efi_virtmap_load()
28#define arch_efi_call_virt_teardown() efi_virtmap_unload()
Ard Biesheuvelda58fb62015-09-24 13:49:52 -070029
Mark Rutland819fc122016-04-25 21:07:05 +010030#define arch_efi_call_virt(f, args...) \
Ard Biesheuvelda58fb62015-09-24 13:49:52 -070031({ \
32 efi_##f##_t *__f; \
Ard Biesheuvelda58fb62015-09-24 13:49:52 -070033 __f = efi.systab->runtime->f; \
Mark Rutland819fc122016-04-25 21:07:05 +010034 __f(args); \
Ard Biesheuvelda58fb62015-09-24 13:49:52 -070035})
36
37static inline void efi_set_pgd(struct mm_struct *mm)
38{
39 check_and_switch_context(mm, NULL);
40}
41
42void efi_virtmap_load(void);
43void efi_virtmap_unload(void);
44
45#else
46#define efi_init()
47#endif /* CONFIG_EFI */
48
Roy Franz81a0bc32015-09-23 20:17:54 -070049/* arch specific definitions used by the stub code */
50
Ard Biesheuvelfc372062016-04-25 21:06:49 +010051#define efi_call_early(f, ...) sys_table_arg->boottime->f(__VA_ARGS__)
52#define __efi_call_early(f, ...) f(__VA_ARGS__)
53#define efi_is_64bit() (false)
Roy Franz81a0bc32015-09-23 20:17:54 -070054
Ard Biesheuvel801820b2016-04-25 21:06:53 +010055struct screen_info *alloc_screen_info(efi_system_table_t *sys_table_arg);
56void free_screen_info(efi_system_table_t *sys_table, struct screen_info *si);
57
Ard Biesheuvel98225042016-04-25 21:06:56 +010058static inline void efifb_setup_from_dmi(struct screen_info *si, const char *opt)
59{
60}
61
Roy Franz81a0bc32015-09-23 20:17:54 -070062/*
63 * A reasonable upper bound for the uncompressed kernel size is 32 MBytes,
64 * so we will reserve that amount of memory. We have no easy way to tell what
65 * the actuall size of code + data the uncompressed kernel will use.
66 * If this is insufficient, the decompressor will relocate itself out of the
67 * way before performing the decompression.
68 */
69#define MAX_UNCOMP_KERNEL_SIZE SZ_32M
70
71/*
72 * The kernel zImage should preferably be located between 32 MB and 128 MB
73 * from the base of DRAM. The min address leaves space for a maximal size
74 * uncompressed image, and the max address is due to how the zImage decompressor
75 * picks a destination address.
76 */
77#define ZIMAGE_OFFSET_LIMIT SZ_128M
78#define MIN_ZIMAGE_OFFSET MAX_UNCOMP_KERNEL_SIZE
79#define MAX_FDT_OFFSET ZIMAGE_OFFSET_LIMIT
80
Ard Biesheuvelda58fb62015-09-24 13:49:52 -070081#endif /* _ASM_ARM_EFI_H */