mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-11-09 19:10:45 +01:00
The include/linux/pgtable.h is going to be the home of generic page table manipulation functions. Start with moving asm-generic/pgtable.h to include/linux/pgtable.h and make the latter include asm/pgtable.h. Signed-off-by: Mike Rapoport <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Brian Cain <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: Chris Zankel <[email protected]> Cc: "David S. Miller" <[email protected]> Cc: Geert Uytterhoeven <[email protected]> Cc: Greentime Hu <[email protected]> Cc: Greg Ungerer <[email protected]> Cc: Guan Xuetao <[email protected]> Cc: Guo Ren <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Helge Deller <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Ley Foon Tan <[email protected]> Cc: Mark Salter <[email protected]> Cc: Matthew Wilcox <[email protected]> Cc: Matt Turner <[email protected]> Cc: Max Filippov <[email protected]> Cc: Michael Ellerman <[email protected]> Cc: Michal Simek <[email protected]> Cc: Nick Hu <[email protected]> Cc: Paul Walmsley <[email protected]> Cc: Richard Weinberger <[email protected]> Cc: Rich Felker <[email protected]> Cc: Russell King <[email protected]> Cc: Stafford Horne <[email protected]> Cc: Thomas Bogendoerfer <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Tony Luck <[email protected]> Cc: Vincent Chen <[email protected]> Cc: Vineet Gupta <[email protected]> Cc: Will Deacon <[email protected]> Cc: Yoshinori Sato <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Linus Torvalds <[email protected]>
56 lines
1.5 KiB
C
56 lines
1.5 KiB
C
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
/*
|
|
* Copyright (C) 2020 Western Digital Corporation or its affiliates.
|
|
*/
|
|
#include <linux/init.h>
|
|
#include <linux/libfdt.h>
|
|
#include <linux/pgtable.h>
|
|
#include <asm/soc.h>
|
|
|
|
/*
|
|
* This is called extremly early, before parse_dtb(), to allow initializing
|
|
* SoC hardware before memory or any device driver initialization.
|
|
*/
|
|
void __init soc_early_init(void)
|
|
{
|
|
void (*early_fn)(const void *fdt);
|
|
const struct of_device_id *s;
|
|
const void *fdt = dtb_early_va;
|
|
|
|
for (s = (void *)&__soc_early_init_table_start;
|
|
(void *)s < (void *)&__soc_early_init_table_end; s++) {
|
|
if (!fdt_node_check_compatible(fdt, 0, s->compatible)) {
|
|
early_fn = s->data;
|
|
early_fn(fdt);
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
|
|
static bool soc_builtin_dtb_match(unsigned long vendor_id,
|
|
unsigned long arch_id, unsigned long imp_id,
|
|
const struct soc_builtin_dtb *entry)
|
|
{
|
|
return entry->vendor_id == vendor_id &&
|
|
entry->arch_id == arch_id &&
|
|
entry->imp_id == imp_id;
|
|
}
|
|
|
|
void * __init soc_lookup_builtin_dtb(void)
|
|
{
|
|
unsigned long vendor_id, arch_id, imp_id;
|
|
const struct soc_builtin_dtb *s;
|
|
|
|
__asm__ ("csrr %0, mvendorid" : "=r"(vendor_id));
|
|
__asm__ ("csrr %0, marchid" : "=r"(arch_id));
|
|
__asm__ ("csrr %0, mimpid" : "=r"(imp_id));
|
|
|
|
for (s = (void *)&__soc_builtin_dtb_table_start;
|
|
(void *)s < (void *)&__soc_builtin_dtb_table_end; s++) {
|
|
if (soc_builtin_dtb_match(vendor_id, arch_id, imp_id, s))
|
|
return s->dtb_func();
|
|
}
|
|
|
|
return NULL;
|
|
}
|