/* SPDX-License-Identifier: GPL-2.01*2* Copyright (C) 1999 by Kaz Kojima3*4* Defitions for the address spaces of the SH CPUs.5*/6#ifndef __ASM_SH_ADDRSPACE_H7#define __ASM_SH_ADDRSPACE_H89#include <cpu/addrspace.h>1011/* If this CPU supports segmentation, hook up the helpers */12#ifdef P1SEG1314/*15[ P0/U0 (virtual) ] 0x00000000 <------ User space16[ P1 (fixed) cached ] 0x80000000 <------ Kernel space17[ P2 (fixed) non-cachable] 0xA0000000 <------ Physical access18[ P3 (virtual) cached] 0xC0000000 <------ vmalloced area19[ P4 control ] 0xE000000020*/2122/* Returns the privileged segment base of a given address */23#define PXSEG(a) (((unsigned long)(a)) & 0xe0000000)2425#ifdef CONFIG_29BIT26/*27* Map an address to a certain privileged segment28*/29#define P1SEGADDR(a) \30((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | P1SEG))31#define P2SEGADDR(a) \32((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | P2SEG))33#define P3SEGADDR(a) \34((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | P3SEG))35#define P4SEGADDR(a) \36((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | P4SEG))37#else38/*39* These will never work in 32-bit, don't even bother.40*/41#define P1SEGADDR(a) ({ (void)(a); BUG(); NULL; })42#define P2SEGADDR(a) ({ (void)(a); BUG(); NULL; })43#define P3SEGADDR(a) ({ (void)(a); BUG(); NULL; })44#define P4SEGADDR(a) ({ (void)(a); BUG(); NULL; })45#endif46#endif /* P1SEG */4748/* Check if an address can be reached in 29 bits */49#define IS_29BIT(a) (((unsigned long)(a)) < 0x20000000)5051#ifdef CONFIG_SH_STORE_QUEUES52/*53* This is a special case for the SH-4 store queues, as pages for this54* space still need to be faulted in before it's possible to flush the55* store queue cache for writeout to the remapped region.56*/57#define P3_ADDR_MAX (P4SEG_STORE_QUE + 0x04000000)58#else59#define P3_ADDR_MAX P4SEG60#endif6162#endif /* __ASM_SH_ADDRSPACE_H */636465