Home | History | Annotate | Line # | Download | only in include
mips_param.h revision 1.25
      1  1.25      matt /*	$NetBSD: mips_param.h,v 1.25 2009/08/13 05:15:09 matt Exp $	*/
      2  1.16    simonb 
      3  1.18   mycroft #ifdef _KERNEL
      4  1.16    simonb #include <machine/cpu.h>
      5  1.18   mycroft #endif
      6   1.5  jonathan 
      7   1.5  jonathan /*
      8   1.5  jonathan  * On mips, UPAGES is fixed by sys/arch/mips/mips/locore code
      9   1.5  jonathan  * to be the number of per-process-wired kernel-stack pages/PTES.
     10   1.5  jonathan  */
     11   1.5  jonathan 
     12   1.6  jonathan #define	SSIZE		1		/* initial stack size/NBPG */
     13   1.6  jonathan #define	SINCR		1		/* increment of stack/NBPG */
     14   1.6  jonathan 
     15  1.24      matt #ifdef ENABLE_MIPS_16KB_PAGE
     16  1.24      matt #define	UPAGES		1		/* pages of u-area */
     17  1.24      matt #define	USPACE		(UPAGES*NBPG)	/* size of u-area in bytes */
     18  1.24      matt #elif defined(ENABLE_MIPS_4KB_PAGE) || 1
     19   1.5  jonathan #define	UPAGES		2		/* pages of u-area */
     20  1.21   tsutsui #define	USPACE		(UPAGES*NBPG)	/* size of u-area in bytes */
     21  1.24      matt #else
     22  1.24      matt #error ENABLE_MIPS_xKB_PAGE not defined
     23  1.24      matt #endif
     24   1.5  jonathan 
     25   1.7       leo #ifndef MSGBUFSIZE
     26   1.7       leo #define MSGBUFSIZE	NBPG		/* default message buffer size */
     27   1.7       leo #endif
     28   1.1  jonathan 
     29   1.1  jonathan /*
     30   1.1  jonathan  * Round p (pointer or byte index) up to a correctly-aligned value for all
     31   1.1  jonathan  * data types (int, long, ...).   The result is u_int and must be cast to
     32   1.1  jonathan  * any desired pointer type.
     33  1.10  jonathan  *
     34  1.10  jonathan  * ALIGNED_POINTER is a boolean macro that checks whether an address
     35  1.10  jonathan  * is valid to fetch data elements of type t from on this architecture.
     36  1.10  jonathan  * This does not reflect the optimal alignment, just the possibility
     37  1.13    simonb  * (within reasonable limits).
     38  1.10  jonathan  *
     39   1.1  jonathan  */
     40   1.1  jonathan #define	ALIGNBYTES	7
     41  1.22      matt #define	ALIGN(p)	(((uintptr_t)(p) + ALIGNBYTES) & ~ALIGNBYTES)
     42  1.22      matt #define ALIGNED_POINTER(p,t)	((((uintptr_t)(p)) & (sizeof(t)-1)) == 0)
     43   1.1  jonathan 
     44  1.24      matt #ifdef ENABLE_MIPS_16KB_PAGE
     45  1.24      matt #define	NBPG		16384		/* bytes/page */
     46  1.24      matt #define	PGSHIFT		14		/* LOG2(NBPG) */
     47  1.24      matt #else
     48   1.1  jonathan #define	NBPG		4096		/* bytes/page */
     49  1.24      matt #define	PGSHIFT		12		/* LOG2(NBPG) */
     50  1.24      matt #endif
     51   1.1  jonathan #define	PGOFSET		(NBPG-1)	/* byte offset into page */
     52   1.1  jonathan #define	NPTEPG		(NBPG/4)
     53   1.1  jonathan 
     54  1.24      matt #define NBSEG		(NBPG*NPTEPG)	/* bytes/segment */
     55   1.1  jonathan #define	SEGOFSET	(NBSEG-1)	/* byte offset into segment */
     56  1.24      matt #define	SEGSHIFT	(2*PGSHIFT-2)	/* LOG2(NBSEG) */
     57   1.1  jonathan 
     58   1.1  jonathan /*
     59  1.17   thorpej  * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized
     60  1.17   thorpej  * logical pages.
     61  1.13    simonb  */
     62  1.17   thorpej #define	NKMEMPAGES_MIN_DEFAULT	((8 * 1024 * 1024) >> PAGE_SHIFT)
     63  1.17   thorpej #define	NKMEMPAGES_MAX_DEFAULT	((128 * 1024 * 1024) >> PAGE_SHIFT)
     64   1.1  jonathan 
     65   1.1  jonathan /*
     66   1.1  jonathan  * Mach derived conversion macros
     67   1.1  jonathan  */
     68  1.22      matt #define mips_round_page(x)	((((uintptr_t)(x)) + NBPG - 1) & ~(NBPG-1))
     69  1.22      matt #define mips_trunc_page(x)	((uintptr_t)(x) & ~(NBPG-1))
     70  1.20      soda #define mips_btop(x)		((paddr_t)(x) >> PGSHIFT)
     71  1.20      soda #define mips_ptob(x)		((paddr_t)(x) << PGSHIFT)
     72  1.25      matt 
     73  1.25      matt #ifdef __MIPSEL__
     74  1.25      matt #define	MID_MACHINE	135	/* MID_PMAX (little-endian) */
     75  1.25      matt #endif
     76  1.25      matt #ifdef __MIPSEB__
     77  1.25      matt #define	MID_MACHINE	152	/* MID_MIPS (big-endian) */
     78  1.25      matt #endif
     79  1.25      matt 
     80