// SPDX-License-Identifier: GPL-2.0-or-later1/*2* OpenRISC ioremap.c3*4* Linux architectural port borrowing liberally from similar works of5* others. All original copyrights apply as per the original source6* declaration.7*8* Modifications for the OpenRISC architecture:9* Copyright (C) 2003 Matjaz Breskvar <[email protected]>10* Copyright (C) 2010-2011 Jonas Bonn <[email protected]>11*/1213#include <linux/vmalloc.h>14#include <linux/io.h>15#include <linux/pgtable.h>16#include <asm/pgalloc.h>17#include <asm/fixmap.h>18#include <asm/bug.h>19#include <linux/sched.h>20#include <asm/tlbflush.h>2122extern int mem_init_done;2324/*25* OK, this one's a bit tricky... ioremap can get called before memory is26* initialized (early serial console does this) and will want to alloc a page27* for its mapping. No userspace pages will ever get allocated before memory28* is initialized so this applies only to kernel pages. In the event that29* this is called before memory is initialized we allocate the page using30* the memblock infrastructure.31*/3233pte_t __ref *pte_alloc_one_kernel(struct mm_struct *mm)34{35pte_t *pte;3637if (likely(mem_init_done)) {38pte = __pte_alloc_one_kernel(mm);39} else {40pte = memblock_alloc_or_panic(PAGE_SIZE, PAGE_SIZE);41}4243return pte;44}454647