mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-15 20:36:49 +07:00
6943f3da3e
Move all applicable EXPORT_SYMBOL()s to the file where the respective symbol is defined. Removed all the includes that are no longer needed in sparc_ksyms_32.c Comment all remaining EXPORT_SYMBOL()s in sparc_ksyms_32.c Two symbols are shared with sparc64 thus the exports were removed from the sparc_ksyms_64.c too, along with the include their ommission made redundant. Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Additions by Julian Calaby: * Moved EXPORT_SYMBOL()s for prom functions to their rightful places. * Made some minor cleanups to the includes and comments of sparc_ksyms_32.c * Made another subtraction from sparc_ksyms_64.c * Updated and tidied commit message. * Rebased patch over sparc-2.6.git HEAD. * Ensured that all modified files have the correct includes. Signed-off-by: Julian Calaby <julian.calaby@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
99 lines
2.5 KiB
C
99 lines
2.5 KiB
C
/*
|
|
* generic.c: Generic Sparc mm routines that are not dependent upon
|
|
* MMU type but are Sparc specific.
|
|
*
|
|
* Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
|
|
*/
|
|
|
|
#include <linux/kernel.h>
|
|
#include <linux/mm.h>
|
|
#include <linux/swap.h>
|
|
#include <linux/pagemap.h>
|
|
|
|
#include <asm/pgalloc.h>
|
|
#include <asm/pgtable.h>
|
|
#include <asm/page.h>
|
|
#include <asm/cacheflush.h>
|
|
#include <asm/tlbflush.h>
|
|
|
|
/* Remap IO memory, the same way as remap_pfn_range(), but use
|
|
* the obio memory space.
|
|
*
|
|
* They use a pgprot that sets PAGE_IO and does not check the
|
|
* mem_map table as this is independent of normal memory.
|
|
*/
|
|
static inline void io_remap_pte_range(struct mm_struct *mm, pte_t * pte, unsigned long address, unsigned long size,
|
|
unsigned long offset, pgprot_t prot, int space)
|
|
{
|
|
unsigned long end;
|
|
|
|
address &= ~PMD_MASK;
|
|
end = address + size;
|
|
if (end > PMD_SIZE)
|
|
end = PMD_SIZE;
|
|
do {
|
|
set_pte_at(mm, address, pte, mk_pte_io(offset, prot, space));
|
|
address += PAGE_SIZE;
|
|
offset += PAGE_SIZE;
|
|
pte++;
|
|
} while (address < end);
|
|
}
|
|
|
|
static inline int io_remap_pmd_range(struct mm_struct *mm, pmd_t * pmd, unsigned long address, unsigned long size,
|
|
unsigned long offset, pgprot_t prot, int space)
|
|
{
|
|
unsigned long end;
|
|
|
|
address &= ~PGDIR_MASK;
|
|
end = address + size;
|
|
if (end > PGDIR_SIZE)
|
|
end = PGDIR_SIZE;
|
|
offset -= address;
|
|
do {
|
|
pte_t * pte = pte_alloc_map(mm, pmd, address);
|
|
if (!pte)
|
|
return -ENOMEM;
|
|
io_remap_pte_range(mm, pte, address, end - address, address + offset, prot, space);
|
|
address = (address + PMD_SIZE) & PMD_MASK;
|
|
pmd++;
|
|
} while (address < end);
|
|
return 0;
|
|
}
|
|
|
|
int io_remap_pfn_range(struct vm_area_struct *vma, unsigned long from,
|
|
unsigned long pfn, unsigned long size, pgprot_t prot)
|
|
{
|
|
int error = 0;
|
|
pgd_t * dir;
|
|
unsigned long beg = from;
|
|
unsigned long end = from + size;
|
|
struct mm_struct *mm = vma->vm_mm;
|
|
int space = GET_IOSPACE(pfn);
|
|
unsigned long offset = GET_PFN(pfn) << PAGE_SHIFT;
|
|
|
|
/* See comment in mm/memory.c remap_pfn_range */
|
|
vma->vm_flags |= VM_IO | VM_RESERVED | VM_PFNMAP;
|
|
vma->vm_pgoff = (offset >> PAGE_SHIFT) |
|
|
((unsigned long)space << 28UL);
|
|
|
|
offset -= from;
|
|
dir = pgd_offset(mm, from);
|
|
flush_cache_range(vma, beg, end);
|
|
|
|
while (from < end) {
|
|
pmd_t *pmd = pmd_alloc(mm, dir, from);
|
|
error = -ENOMEM;
|
|
if (!pmd)
|
|
break;
|
|
error = io_remap_pmd_range(mm, pmd, from, end - from, offset + from, prot, space);
|
|
if (error)
|
|
break;
|
|
from = (from + PGDIR_SIZE) & PGDIR_MASK;
|
|
dir++;
|
|
}
|
|
|
|
flush_tlb_range(vma, beg, end);
|
|
return error;
|
|
}
|
|
EXPORT_SYMBOL(io_remap_pfn_range);
|