@@ -65,6 +65,7 @@ config RISCV
select ARCH_HAS_GCOV_PROFILE_ALL
select HAVE_COPY_THREAD_TLS
select HAVE_ARCH_KASAN if MMU && 64BIT
+ select GENERIC_EARLY_IOREMAP
config ARCH_MMAP_RND_BITS_MIN
default 18 if 64BIT
@@ -4,6 +4,7 @@ generic-y += checksum.h
generic-y += compat.h
generic-y += device.h
generic-y += div64.h
+generic-y += early_ioremap.h
generic-y += extable.h
generic-y += flat.h
generic-y += dma.h
@@ -25,9 +25,28 @@ enum fixed_addresses {
#define FIX_FDT_SIZE SZ_1M
FIX_FDT_END,
FIX_FDT = FIX_FDT_END + FIX_FDT_SIZE / PAGE_SIZE - 1,
+ FIX_EARLYCON_MEM_BASE,
+
FIX_PTE,
FIX_PMD,
- FIX_EARLYCON_MEM_BASE,
+ /*
+ * Make sure that it is 2MB aligned.
+ */
+#define NR_FIX_SZ_2M (SZ_2M / PAGE_SIZE)
+ FIX_THOLE = NR_FIX_SZ_2M - FIX_PMD - 1,
+
+ __end_of_permanent_fixed_addresses,
+ /*
+ * Temporary boot-time mappings, used by early_ioremap(),
+ * before ioremap() is functional.
+ */
+#define NR_FIX_BTMAPS (SZ_256K / PAGE_SIZE)
+#define FIX_BTMAPS_SLOTS 7
+#define TOTAL_FIX_BTMAPS (NR_FIX_BTMAPS * FIX_BTMAPS_SLOTS)
+
+ FIX_BTMAP_END = __end_of_permanent_fixed_addresses,
+ FIX_BTMAP_BEGIN = FIX_BTMAP_END + TOTAL_FIX_BTMAPS - 1,
+
__end_of_fixed_addresses
};
@@ -14,6 +14,7 @@
#include <linux/types.h>
#include <asm/mmiowb.h>
#include <asm/pgtable.h>
+#include <asm/early_ioremap.h>
/*
* MMIO access functions are separated out to break dependency cycles
UEFI uses early IO or memory mappings for runtime services before normal ioremap() is usable. This patch only adds minimum necessary fixmap bindings and headers for generic ioremap support to work. Signed-off-by: Atish Patra <atish.patra@wdc.com> --- arch/riscv/Kconfig | 1 + arch/riscv/include/asm/Kbuild | 1 + arch/riscv/include/asm/fixmap.h | 21 ++++++++++++++++++++- arch/riscv/include/asm/io.h | 1 + 4 files changed, 23 insertions(+), 1 deletion(-)