X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=include%2Fasm-ppc64%2Fmmu.h;h=616389dc82661f2b225f40c038fbd7e84183f60d;hb=c7b5ebbddf7bcd3651947760f423e3783bbe6573;hp=b42d9a4db08fb5962b62fdfac05ed66c3b5085e7;hpb=5273a3df6485dc2ad6aa7ddd441b9a21970f003b;p=linux-2.6.git diff --git a/include/asm-ppc64/mmu.h b/include/asm-ppc64/mmu.h index b42d9a4db..616389dc8 100644 --- a/include/asm-ppc64/mmu.h +++ b/include/asm-ppc64/mmu.h @@ -15,6 +15,7 @@ #include #include +#include #ifndef __ASSEMBLY__ @@ -27,88 +28,17 @@ typedef struct { #endif } mm_context_t; -#ifdef CONFIG_HUGETLB_PAGE -#define KERNEL_LOW_HPAGES .htlb_segs = 0, -#else -#define KERNEL_LOW_HPAGES -#endif - -#define KERNEL_CONTEXT(ea) ({ \ - mm_context_t ctx = { .id = REGION_ID(ea), KERNEL_LOW_HPAGES}; \ - ctx; }) - -/* - * Hardware Segment Lookaside Buffer Entry - * This structure has been padded out to two 64b doublewords (actual SLBE's are - * 94 bits). This padding facilites use by the segment management - * instructions. - */ -typedef struct { - unsigned long esid: 36; /* Effective segment ID */ - unsigned long resv0:20; /* Reserved */ - unsigned long v: 1; /* Entry valid (v=1) or invalid */ - unsigned long resv1: 1; /* Reserved */ - unsigned long ks: 1; /* Supervisor (privileged) state storage key */ - unsigned long kp: 1; /* Problem state storage key */ - unsigned long n: 1; /* No-execute if n=1 */ - unsigned long resv2: 3; /* padding to a 64b boundary */ -} ste_dword0; - -typedef struct { - unsigned long vsid: 52; /* Virtual segment ID */ - unsigned long resv0:12; /* Padding to a 64b boundary */ -} ste_dword1; - -typedef struct _STE { - union { - unsigned long dword0; - ste_dword0 dw0; - } dw0; - - union { - unsigned long dword1; - ste_dword1 dw1; - } dw1; -} STE; - -typedef struct { - unsigned long esid: 36; /* Effective segment ID */ - unsigned long v: 1; /* Entry valid (v=1) or invalid */ - unsigned long null1:15; /* padding to a 64b boundary */ - unsigned long index:12; /* Index to select SLB entry. Used by slbmte */ -} slb_dword0; - -typedef struct { - unsigned long vsid: 52; /* Virtual segment ID */ - unsigned long ks: 1; /* Supervisor (privileged) state storage key */ - unsigned long kp: 1; /* Problem state storage key */ - unsigned long n: 1; /* No-execute if n=1 */ - unsigned long l: 1; /* Virt pages are large (l=1) or 4KB (l=0) */ - unsigned long c: 1; /* Class */ - unsigned long resv0: 7; /* Padding to a 64b boundary */ -} slb_dword1; - -typedef struct { - union { - unsigned long dword0; - slb_dword0 dw0; - } dw0; +#define STE_ESID_V 0x80 +#define STE_ESID_KS 0x20 +#define STE_ESID_KP 0x10 +#define STE_ESID_N 0x08 - union { - unsigned long dword1; - slb_dword1 dw1; - } dw1; -} SLBE; +#define STE_VSID_SHIFT 12 -/* - * This structure is used in paca.h where the layout depends on the - * size being 24B. - */ -typedef struct { - unsigned long real; - unsigned long virt; - unsigned long next_round_robin; -} STAB; +struct stab_entry { + unsigned long esid_data; + unsigned long vsid_data; +}; /* Hardware Page Table Entry */ @@ -177,20 +107,6 @@ typedef struct { extern HTAB htab_data; -void invalidate_hpte( unsigned long slot ); -long select_hpte_slot( unsigned long vpn ); -void create_valid_hpte( unsigned long slot, unsigned long vpn, - unsigned long prpn, unsigned hash, - void * ptep, unsigned hpteflags, - unsigned bolted ); - -#define PD_SHIFT (10+12) /* Page directory */ -#define PD_MASK 0x02FF -#define PT_SHIFT (12) /* Page Table */ -#define PT_MASK 0x02FF - -#define LARGE_PAGE_SHIFT 24 - static inline unsigned long hpt_hash(unsigned long vpn, int large) { unsigned long vsid; @@ -204,7 +120,7 @@ static inline unsigned long hpt_hash(unsigned long vpn, int large) page = vpn & 0xffff; } - return (vsid & 0x7fffffffff) ^ page; + return (vsid & 0x7fffffffffUL) ^ page; } static inline void __tlbie(unsigned long va, int large) @@ -269,149 +185,60 @@ extern void htab_finish_init(void); #define STAB0_PHYS_ADDR (STAB0_PAGE<= \ + * 2^36-1, then r3+1 has the 2^36 bit set. So, if r3+1 has \ + * the bit clear, r3 already has the answer we want, if it \ + * doesn't, the answer is the low 36 bits of r3+1. So in all \ + * cases the answer is the low 36 bits of (r3 + ((r3+1) >> 36))*/\ + addi rx,rt,1; \ + srdi rx,rx,VSID_BITS; /* extract 2^36 bit */ \ + add rt,rt,rx #endif /* _PPC64_MMU_H_ */