mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 04:38:03 +00:00
8f24608772
Functions that work on a pointer to virtual memory such as virt_to_pfn() and users of that function such as virt_to_page() are supposed to pass a pointer to virtual memory, ideally a (void *) or other pointer. However since many architectures implement virt_to_pfn() as a macro, this function becomes polymorphic and accepts both a (unsigned long) and a (void *). Fix up the offending calls in arch/m68k with explicit casts. The page table include <asm/pgtable.h> will include different variants of the defines depending on whether you build for classic m68k, ColdFire or Sun3, so fix all variants. Delete Coldfire pte_pagenr() which was using unsigned long semantics from __pte_page(). Tested-by: Geert Uytterhoeven <geert@linux-m68k.org> Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
69 lines
1.3 KiB
C
69 lines
1.3 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
/*
|
|
* linux/arch/m68k/sun3/dvma.c
|
|
*
|
|
* Written by Sam Creasey
|
|
*
|
|
* Sun3 IOMMU routines used for dvma accesses.
|
|
*
|
|
*/
|
|
|
|
#include <linux/init.h>
|
|
#include <linux/kernel.h>
|
|
#include <linux/mm.h>
|
|
#include <linux/memblock.h>
|
|
#include <linux/list.h>
|
|
#include <asm/page.h>
|
|
#include <asm/sun3mmu.h>
|
|
#include <asm/dvma.h>
|
|
|
|
|
|
static unsigned long ptelist[120];
|
|
|
|
static unsigned long dvma_page(unsigned long kaddr, unsigned long vaddr)
|
|
{
|
|
unsigned long pte;
|
|
unsigned long j;
|
|
pte_t ptep;
|
|
|
|
j = *(volatile unsigned long *)kaddr;
|
|
*(volatile unsigned long *)kaddr = j;
|
|
|
|
ptep = pfn_pte(virt_to_pfn((void *)kaddr), PAGE_KERNEL);
|
|
pte = pte_val(ptep);
|
|
// pr_info("dvma_remap: addr %lx -> %lx pte %08lx\n", kaddr, vaddr, pte);
|
|
if(ptelist[(vaddr & 0xff000) >> PAGE_SHIFT] != pte) {
|
|
sun3_put_pte(vaddr, pte);
|
|
ptelist[(vaddr & 0xff000) >> PAGE_SHIFT] = pte;
|
|
}
|
|
|
|
return (vaddr + (kaddr & ~PAGE_MASK));
|
|
|
|
}
|
|
|
|
int dvma_map_iommu(unsigned long kaddr, unsigned long baddr,
|
|
int len)
|
|
{
|
|
|
|
unsigned long end;
|
|
unsigned long vaddr;
|
|
|
|
vaddr = dvma_btov(baddr);
|
|
|
|
end = vaddr + len;
|
|
|
|
while(vaddr < end) {
|
|
dvma_page(kaddr, vaddr);
|
|
kaddr += PAGE_SIZE;
|
|
vaddr += PAGE_SIZE;
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
void __init sun3_dvma_init(void)
|
|
{
|
|
memset(ptelist, 0, sizeof(ptelist));
|
|
}
|