mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
1. Use phys_addr_t instead of u64, which can work for both 32/64 bits. 2. Check whether the input physical address is above TO_PHYS_MASK (and return NULL if yes) for the DMW version. Note: In theory early_ioremap() also need the TO_PHYS_MASK checking, but the UEFI BIOS pass some DMW virtual addresses. Cc: stable@vger.kernel.org Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
29 lines
654 B
C
29 lines
654 B
C
// SPDX-License-Identifier: GPL-2.0
|
|
/*
|
|
* Copyright (C) 2020-2022 Loongson Technology Corporation Limited
|
|
*/
|
|
|
|
#include <asm/io.h>
|
|
#include <asm-generic/early_ioremap.h>
|
|
|
|
void __init __iomem *early_ioremap(phys_addr_t phys_addr, unsigned long size)
|
|
{
|
|
return ((void __iomem *)TO_CACHE(phys_addr));
|
|
}
|
|
|
|
void __init early_iounmap(void __iomem *addr, unsigned long size)
|
|
{
|
|
|
|
}
|
|
|
|
void * __init early_memremap_ro(resource_size_t phys_addr, unsigned long size)
|
|
{
|
|
return early_memremap(phys_addr, size);
|
|
}
|
|
|
|
void * __init early_memremap_prot(resource_size_t phys_addr, unsigned long size,
|
|
unsigned long prot_val)
|
|
{
|
|
return early_memremap(phys_addr, size);
|
|
}
|