arch/loongarch/include/asm/addrspace.h

Source file repositories/reference/linux-study-clean/arch/loongarch/include/asm/addrspace.h

File Facts

System
Linux kernel
Corpus path
arch/loongarch/include/asm/addrspace.h
Extension
.h
Size
3288 bytes
Lines
149
Domain
Architecture Layer
Bucket
arch/loongarch
Inferred role
Architecture Layer: implementation source
Status
source implementation candidate

Why This File Exists

CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.

Dependency Surface

Detected Declarations

Annotated Snippet

#ifndef _ASM_ADDRSPACE_H
#define _ASM_ADDRSPACE_H

#include <linux/const.h>
#include <linux/sizes.h>

#include <asm/loongarch.h>

/*
 * This gives the physical RAM offset.
 */
#ifndef __ASSEMBLER__
#ifndef PHYS_OFFSET
#define PHYS_OFFSET	_UL(0)
#endif
extern unsigned long vm_map_base;
#endif /* __ASSEMBLER__ */

#ifndef IO_BASE
#define IO_BASE			CSR_DMW0_BASE
#endif

#ifndef CACHE_BASE
#define CACHE_BASE		CSR_DMW1_BASE
#endif

#ifndef UNCACHE_BASE
#define UNCACHE_BASE		CSR_DMW0_BASE
#endif

#ifndef WRITECOMBINE_BASE
#ifdef CONFIG_32BIT
#define WRITECOMBINE_BASE	CSR_DMW0_BASE
#else
#define WRITECOMBINE_BASE	CSR_DMW2_BASE
#endif
#endif

#ifdef CONFIG_32BIT
#define DMW_PABITS	29
#define TO_PHYS_MASK	((_UL(1) << _UL(DMW_PABITS)) - 1)
#else
#define DMW_PABITS	48
#define TO_PHYS_MASK	((_ULL(1) << _ULL(DMW_PABITS)) - 1)
#endif

/*
 * Memory above this physical address will be considered highmem.
 */
#ifndef HIGHMEM_START
#define HIGHMEM_START		(_UL(1) << _UL(DMW_PABITS))
#endif

#define TO_PHYS(x)		(		((x) & TO_PHYS_MASK))
#define TO_CACHE(x)		(CACHE_BASE   |	((x) & TO_PHYS_MASK))
#define TO_UNCACHE(x)		(UNCACHE_BASE |	((x) & TO_PHYS_MASK))

/*
 * This handles the memory map.
 */
#ifndef PAGE_OFFSET
#define PAGE_OFFSET		(CACHE_BASE + PHYS_OFFSET)
#endif

#ifndef FIXADDR_TOP
#define FIXADDR_TOP		((unsigned long)(long)(int)0xfffe0000)
#endif

#ifdef __ASSEMBLER__
#define _ATYPE_
#define _ATYPE32_
#define _ATYPE64_
#else
#define _ATYPE_		__PTRDIFF_TYPE__
#define _ATYPE32_	int
#define _ATYPE64_	__s64
#endif

#ifdef CONFIG_64BIT
#define _CONST64_(x)	_UL(x)
#else
#define _CONST64_(x)	_ULL(x)
#endif

/*
 *  32/64-bit LoongArch address spaces
 */
#ifdef __ASSEMBLER__
#define _ACAST32_
#define _ACAST64_

Annotation

Implementation Notes