mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-19 08:14:25 +00:00
Pull asm-generic updates from Arnd Bergmann:
"These are a number of unrelated cleanups, generally simplifying the
architecture specific header files:
- A series from Al Viro simplifies asm/vga.h, after it turns out that
most of it can be generalized.
- A series from Julian Vetter adds a common version of
memcpy_{to,from}io() and memset_io() and changes most architectures
to use that instead of their own implementation
- A series from Niklas Schnelle concludes his work to make PC style
inb()/outb() optional
- Nicolas Pitre contributes improvements for the generic do_div()
helper
- Christoph Hellwig adds a generic version of page_to_phys() and
phys_to_page(), replacing the slightly different architecture
specific definitions.
- Uwe Kleine-Koenig has a minor cleanup for ioctl definitions"
* tag 'asm-generic-3.13' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic: (24 commits)
empty include/asm-generic/vga.h
sparc: get rid of asm/vga.h
asm/vga.h: don't bother with scr_mem{cpy,move}v() unless we need to
vt_buffer.h: get rid of dead code in default scr_...() instances
tty: serial: export serial_8250_warn_need_ioport
lib/iomem_copy: fix kerneldoc format style
hexagon: simplify asm/io.h for !HAS_IOPORT
loongarch: Use new fallback IO memcpy/memset
csky: Use new fallback IO memcpy/memset
arm64: Use new fallback IO memcpy/memset
New implementation for IO memcpy and IO memset
watchdog: Add HAS_IOPORT dependency for SBC8360 and SBC7240
__arch_xprod64(): make __always_inline when optimizing for performance
ARM: div64: improve __arch_xprod_64()
asm-generic/div64: optimize/simplify __div64_const32()
lib/math/test_div64: add some edge cases relevant to __div64_const32()
asm-generic: add an optional pfn_valid check to page_to_phys
asm-generic: provide generic page_to_phys and phys_to_page implementations
asm-generic/io.h: Remove I/O port accessors for HAS_IOPORT=n
tty: serial: handle HAS_IOPORT dependencies
...
89 lines
2.3 KiB
C
89 lines
2.3 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
|
|
#ifndef __ASM_CSKY_PAGE_H
|
|
#define __ASM_CSKY_PAGE_H
|
|
|
|
#include <asm/setup.h>
|
|
#include <asm/cache.h>
|
|
#include <linux/const.h>
|
|
|
|
#include <vdso/page.h>
|
|
|
|
#define THREAD_SIZE (PAGE_SIZE * 2)
|
|
#define THREAD_MASK (~(THREAD_SIZE - 1))
|
|
#define THREAD_SHIFT (PAGE_SHIFT + 1)
|
|
|
|
|
|
/*
|
|
* For C-SKY "User-space:Kernel-space" is "2GB:2GB" fixed by hardware and there
|
|
* are two segment registers (MSA0 + MSA1) to mapping 512MB + 512MB physical
|
|
* address region. We use them mapping kernel 1GB direct-map address area and
|
|
* for more than 1GB of memory we use highmem.
|
|
*/
|
|
#define PAGE_OFFSET CONFIG_PAGE_OFFSET
|
|
#define SSEG_SIZE 0x20000000
|
|
#define LOWMEM_LIMIT (SSEG_SIZE * 2)
|
|
|
|
#define PHYS_OFFSET_OFFSET (CONFIG_DRAM_BASE & (SSEG_SIZE - 1))
|
|
|
|
#ifndef __ASSEMBLY__
|
|
|
|
#include <linux/pfn.h>
|
|
|
|
#define virt_addr_valid(kaddr) ((void *)(kaddr) >= (void *)PAGE_OFFSET && \
|
|
(void *)(kaddr) < high_memory)
|
|
|
|
extern void *memset(void *dest, int c, size_t l);
|
|
extern void *memcpy(void *to, const void *from, size_t l);
|
|
|
|
#define clear_page(page) memset((page), 0, PAGE_SIZE)
|
|
#define copy_page(to, from) memcpy((to), (from), PAGE_SIZE)
|
|
|
|
struct page;
|
|
|
|
#include <abi/page.h>
|
|
|
|
struct vm_area_struct;
|
|
|
|
typedef struct { unsigned long pte_low; } pte_t;
|
|
#define pte_val(x) ((x).pte_low)
|
|
|
|
typedef struct { unsigned long pgd; } pgd_t;
|
|
typedef struct { unsigned long pgprot; } pgprot_t;
|
|
typedef struct page *pgtable_t;
|
|
|
|
#define pgd_val(x) ((x).pgd)
|
|
#define pgprot_val(x) ((x).pgprot)
|
|
|
|
#define ptep_buddy(x) ((pte_t *)((unsigned long)(x) ^ sizeof(pte_t)))
|
|
|
|
#define __pte(x) ((pte_t) { (x) })
|
|
#define __pgd(x) ((pgd_t) { (x) })
|
|
#define __pgprot(x) ((pgprot_t) { (x) })
|
|
|
|
extern unsigned long va_pa_offset;
|
|
|
|
#define ARCH_PFN_OFFSET PFN_DOWN(va_pa_offset + PHYS_OFFSET_OFFSET)
|
|
|
|
#define __pa(x) ((unsigned long)(x) - PAGE_OFFSET + va_pa_offset)
|
|
#define __va(x) ((void *)((unsigned long)(x) + PAGE_OFFSET - va_pa_offset))
|
|
|
|
#define __pa_symbol(x) __pa(RELOC_HIDE((unsigned long)(x), 0))
|
|
|
|
static inline unsigned long virt_to_pfn(const void *kaddr)
|
|
{
|
|
return __pa(kaddr) >> PAGE_SHIFT;
|
|
}
|
|
|
|
#define MAP_NR(x) PFN_DOWN((unsigned long)(x) - PAGE_OFFSET - \
|
|
PHYS_OFFSET_OFFSET)
|
|
#define virt_to_page(x) (mem_map + MAP_NR(x))
|
|
|
|
#define pfn_to_kaddr(x) __va(PFN_PHYS(x))
|
|
|
|
#include <asm-generic/memory_model.h>
|
|
#include <asm-generic/getorder.h>
|
|
|
|
#endif /* !__ASSEMBLY__ */
|
|
#endif /* __ASM_CSKY_PAGE_H */
|