mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 14:11:52 +00:00
c50b1fc110
When building with W=1: arch/m68k/sun3/idprom.c:86:6: warning: no previous prototype for ‘sun3_get_model’ [-Wmissing-prototypes] 86 | void sun3_get_model(char *model) | ^~~~~~~~~~~~~~ arch/m68k/sun3/config.c:53:24: warning: no previous prototype for ‘sun3_init’ [-Wmissing-prototypes] 53 | asmlinkage void __init sun3_init(void) | ^~~~~~~~~ arch/m68k/sun3/mmu_emu.c:117:6: warning: no previous prototype for ‘print_pte_vaddr’ [-Wmissing-prototypes] 117 | void print_pte_vaddr (unsigned long vaddr) | ^~~~~~~~~~~~~~~ arch/m68k/sun3/mmu_emu.c:126:13: warning: no previous prototype for ‘mmu_emu_init’ [-Wmissing-prototypes] 126 | void __init mmu_emu_init(unsigned long bootmem_end) | ^~~~~~~~~~~~ arch/m68k/sun3/mmu_emu.c:353:5: warning: no previous prototype for ‘mmu_emu_handle_fault’ [-Wmissing-prototypes] 353 | int mmu_emu_handle_fault (unsigned long vaddr, int read_flag, int kernel_fault) | ^~~~~~~~~~~~~~~~~~~~ arch/m68k/sun3/leds.c:6:6: warning: no previous prototype for ‘sun3_leds’ [-Wmissing-prototypes] 6 | void sun3_leds(unsigned char byte) | ^~~~~~~~~ arch/m68k/sun3/intersil.c:27:5: warning: no previous prototype for ‘sun3_hwclk’ [-Wmissing-prototypes] 27 | int sun3_hwclk(int set, struct rtc_time *t) | ^~~~~~~~~~ arch/m68k/sun3x/config.c:30:6: warning: no previous prototype for ‘sun3_leds’ [-Wmissing-prototypes] 30 | void sun3_leds(unsigned char byte) | ^~~~~~~~~ Fix this by introducing a new header file "sun3.h" for holding the prototypes of functions implemented in arch/m68k/sun3/ and arch/m68k/sun3x/. Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Acked-by: Arnd Bergmann <arnd@arndb.de> Link: https://lore.kernel.org/r/87856ef9ef8955f459fb691faca921c0a688bc80.1694613528.git.geert@linux-m68k.org
160 lines
3.3 KiB
C
160 lines
3.3 KiB
C
/*
|
|
* linux/arch/m68k/mm/sun3kmap.c
|
|
*
|
|
* Copyright (C) 2002 Sam Creasey <sammy@sammy.net>
|
|
*
|
|
* This file is subject to the terms and conditions of the GNU General Public
|
|
* License. See the file COPYING in the main directory of this archive
|
|
* for more details.
|
|
*/
|
|
|
|
#include <linux/module.h>
|
|
#include <linux/types.h>
|
|
#include <linux/kernel.h>
|
|
#include <linux/mm.h>
|
|
#include <linux/vmalloc.h>
|
|
|
|
#include <asm/page.h>
|
|
#include <asm/io.h>
|
|
#include <asm/sun3mmu.h>
|
|
|
|
#include "../sun3/sun3.h"
|
|
|
|
#undef SUN3_KMAP_DEBUG
|
|
|
|
extern void mmu_emu_map_pmeg (int context, int vaddr);
|
|
|
|
static inline void do_page_mapin(unsigned long phys, unsigned long virt,
|
|
unsigned long type)
|
|
{
|
|
unsigned long pte;
|
|
pte_t ptep;
|
|
|
|
ptep = pfn_pte(phys >> PAGE_SHIFT, PAGE_KERNEL);
|
|
pte = pte_val(ptep);
|
|
pte |= type;
|
|
|
|
sun3_put_pte(virt, pte);
|
|
|
|
#ifdef SUN3_KMAP_DEBUG
|
|
pr_info("mapin:");
|
|
print_pte_vaddr(virt);
|
|
#endif
|
|
|
|
}
|
|
|
|
static inline void do_pmeg_mapin(unsigned long phys, unsigned long virt,
|
|
unsigned long type, int pages)
|
|
{
|
|
|
|
if(sun3_get_segmap(virt & ~SUN3_PMEG_MASK) == SUN3_INVALID_PMEG)
|
|
mmu_emu_map_pmeg(sun3_get_context(), virt);
|
|
|
|
while(pages) {
|
|
do_page_mapin(phys, virt, type);
|
|
phys += PAGE_SIZE;
|
|
virt += PAGE_SIZE;
|
|
pages--;
|
|
}
|
|
}
|
|
|
|
void __iomem *sun3_ioremap(unsigned long phys, unsigned long size,
|
|
unsigned long type)
|
|
{
|
|
struct vm_struct *area;
|
|
unsigned long offset, virt, ret;
|
|
int pages;
|
|
|
|
if(!size)
|
|
return NULL;
|
|
|
|
/* page align */
|
|
offset = phys & (PAGE_SIZE-1);
|
|
phys &= ~(PAGE_SIZE-1);
|
|
|
|
size += offset;
|
|
size = PAGE_ALIGN(size);
|
|
if((area = get_vm_area(size, VM_IOREMAP)) == NULL)
|
|
return NULL;
|
|
|
|
#ifdef SUN3_KMAP_DEBUG
|
|
pr_info("ioremap: got virt %p size %lx(%lx)\n", area->addr, size,
|
|
area->size);
|
|
#endif
|
|
|
|
pages = size / PAGE_SIZE;
|
|
virt = (unsigned long)area->addr;
|
|
ret = virt + offset;
|
|
|
|
while(pages) {
|
|
int seg_pages;
|
|
|
|
seg_pages = (SUN3_PMEG_SIZE - (virt & SUN3_PMEG_MASK)) / PAGE_SIZE;
|
|
if(seg_pages > pages)
|
|
seg_pages = pages;
|
|
|
|
do_pmeg_mapin(phys, virt, type, seg_pages);
|
|
|
|
pages -= seg_pages;
|
|
phys += seg_pages * PAGE_SIZE;
|
|
virt += seg_pages * PAGE_SIZE;
|
|
}
|
|
|
|
return (void __iomem *)ret;
|
|
|
|
}
|
|
EXPORT_SYMBOL(sun3_ioremap);
|
|
|
|
|
|
void __iomem *__ioremap(unsigned long phys, unsigned long size, int cache)
|
|
{
|
|
|
|
return sun3_ioremap(phys, size, SUN3_PAGE_TYPE_IO);
|
|
|
|
}
|
|
EXPORT_SYMBOL(__ioremap);
|
|
|
|
void iounmap(void __iomem *addr)
|
|
{
|
|
vfree((void *)(PAGE_MASK & (unsigned long)addr));
|
|
}
|
|
EXPORT_SYMBOL(iounmap);
|
|
|
|
/* sun3_map_test(addr, val) -- Reads a byte from addr, storing to val,
|
|
* trapping the potential read fault. Returns 0 if the access faulted,
|
|
* 1 on success.
|
|
*
|
|
* This function is primarily used to check addresses on the VME bus.
|
|
*
|
|
* Mucking with the page fault handler seems a little hackish to me, but
|
|
* SunOS, NetBSD, and Mach all implemented this check in such a manner,
|
|
* so I figure we're allowed.
|
|
*/
|
|
int sun3_map_test(unsigned long addr, char *val)
|
|
{
|
|
int ret = 0;
|
|
|
|
__asm__ __volatile__
|
|
(".globl _sun3_map_test_start\n"
|
|
"_sun3_map_test_start:\n"
|
|
"1: moveb (%2), (%0)\n"
|
|
" moveq #1, %1\n"
|
|
"2:\n"
|
|
".section .fixup,\"ax\"\n"
|
|
".even\n"
|
|
"3: moveq #0, %1\n"
|
|
" jmp 2b\n"
|
|
".previous\n"
|
|
".section __ex_table,\"a\"\n"
|
|
".align 4\n"
|
|
".long 1b,3b\n"
|
|
".previous\n"
|
|
".globl _sun3_map_test_end\n"
|
|
"_sun3_map_test_end:\n"
|
|
: "=a"(val), "=r"(ret)
|
|
: "a"(addr));
|
|
|
|
return ret;
|
|
}
|
|
EXPORT_SYMBOL(sun3_map_test);
|