/* * Memory and machine-specific definitions. Used in C and assembler. */ #define HOWMANY(x, y) (((x)+((y)-1))/(y)) #define ROUNDUP(x, y) (HOWMANY((x), (y))*(y)) /* ceiling */ #define ROUNDDN(x, y) (((x)/(y))*(y)) /* floor */ #define MIN(a, b) ((a) < (b)? (a): (b)) #define MAX(a, b) ((a) > (b)? (a): (b)) /* * Sizes */ #define BI2BY 8 /* bits per byte */ #define BI2WD 32 /* bits per word */ #define BY2WD 4 /* bytes per word */ #define BY2V 8 /* bytes per vlong */ #define BY2PG 4096 /* bytes per page */ #define PGSHIFT 12 /* log(BY2PG) */ #define ROUND(s, sz) (((s)+(sz-1))&~(sz-1)) #define PGROUND(s) ROUND(s, BY2PG) #define CACHELINELOG 4 #define CACHELINESZ (1< */ #define USER 29 /* R29 is up-> */ /* * virtual MMU */ #define PTEMAPMEM (1024*1024) #define PTEPERTAB (PTEMAPMEM/BY2PG) #define SEGMAPSIZE 1984 #define SSEGMAPSIZE 16 #define PPN(x) ((x)&~(BY2PG-1)) /* * First pte word */ #define PTE0(v, vsid, h, va) (((v)<<31)|((vsid)<<7)|((h)<<6)|(((va)>>22)&0x3f)) /* * Second pte word; WIMG & PP(RW/RO) common to page table and BATs */ #define PTE1_W BIT(25) #define PTE1_I BIT(26) #define PTE1_M BIT(27) #define PTE1_G BIT(28) #define PTE1_RW BIT(30) #define PTE1_RO BIT(31) /* * PTE bits for fault.c. These belong to the second PTE word. Validity is * implied for putmmu(), and we always set PTE0_V. PTEVALID is used * here to set cache policy bits on a global basis. */ #define PTEVALID 0 #define PTEWRITE PTE1_RW #define PTERONLY PTE1_RO #define PTEUNCACHED PTE1_I /* * Address spaces */ #define UZERO 0 /* base of user address space */ #define UTZERO (UZERO+BY2PG) /* first address in user text */ #define USTKTOP (TSTKTOP-TSTKSIZ*BY2PG) /* byte just beyond user stack */ #define TSTKTOP KZERO /* top of temporary stack */ #define TSTKSIZ 100 #define KZERO 0x80000000 /* base of kernel address space */ #define KTZERO (KZERO+0x4000) /* first address in kernel text */ #define USTKSIZE (4*1024*1024) /* size of user stack */ #define UREGSIZE ((8+32)*4) #define PCIMEM0 0xf0000000 #define PCISIZE0 0x0e000000 #define PCIMEM1 0xc0000000 #define PCISIZE1 0x30000000 #define IOMEM 0xfe000000 #define IOSIZE 0x00800000 #define FALCON 0xfef80000 #define RAVEN 0xfeff0000 #define FLASHA 0xff000000 #define FLASHB 0xff800000 #define FLASHAorB 0xfff00000 #define isphys(x) (((ulong)x&KZERO)!=0) #define getpgcolor(a) 0