mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-05 01:54:09 +08:00
ca5999fde0
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 <rppt@linux.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Borislav Petkov <bp@alien8.de> Cc: Brian Cain <bcain@codeaurora.org> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Chris Zankel <chris@zankel.net> Cc: "David S. Miller" <davem@davemloft.net> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Cc: Greentime Hu <green.hu@gmail.com> Cc: Greg Ungerer <gerg@linux-m68k.org> Cc: Guan Xuetao <gxt@pku.edu.cn> Cc: Guo Ren <guoren@kernel.org> Cc: Heiko Carstens <heiko.carstens@de.ibm.com> Cc: Helge Deller <deller@gmx.de> Cc: Ingo Molnar <mingo@redhat.com> Cc: Ley Foon Tan <ley.foon.tan@intel.com> Cc: Mark Salter <msalter@redhat.com> Cc: Matthew Wilcox <willy@infradead.org> Cc: Matt Turner <mattst88@gmail.com> Cc: Max Filippov <jcmvbkbc@gmail.com> Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: Michal Simek <monstr@monstr.eu> Cc: Nick Hu <nickhu@andestech.com> Cc: Paul Walmsley <paul.walmsley@sifive.com> Cc: Richard Weinberger <richard@nod.at> Cc: Rich Felker <dalias@libc.org> Cc: Russell King <linux@armlinux.org.uk> Cc: Stafford Horne <shorne@gmail.com> Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Tony Luck <tony.luck@intel.com> Cc: Vincent Chen <deanbo422@gmail.com> Cc: Vineet Gupta <vgupta@synopsys.com> Cc: Will Deacon <will@kernel.org> Cc: Yoshinori Sato <ysato@users.sourceforge.jp> Link: http://lkml.kernel.org/r/20200514170327.31389-3-rppt@kernel.org Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
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;
|
|
}
|