Home | History | Annotate | Line # | Download | only in include
mips_param.h revision 1.5.2.2
      1  1.5.2.2   thorpej /*	$NetBSD: mips_param.h,v 1.5.2.2 1997/09/22 06:32:05 thorpej Exp $	*/
      2      1.3  jonathan 
      3      1.3  jonathan /*
      4      1.3  jonathan  * Architecture name.
      5      1.3  jonathan  */
      6      1.3  jonathan #define	_MACHINE_ARCH	mips
      7      1.3  jonathan #define	MACHINE_ARCH	"mips"
      8      1.5  jonathan 
      9      1.5  jonathan /*
     10      1.5  jonathan  * NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE.
     11      1.5  jonathan  * On mips, UPAGES is fixed by sys/arch/mips/mips/locore code
     12      1.5  jonathan  * to be the number of per-process-wired kernel-stack pages/PTES.
     13      1.5  jonathan  */
     14      1.5  jonathan 
     15  1.5.2.1   thorpej #define	SSIZE		1		/* initial stack size/NBPG */
     16  1.5.2.1   thorpej #define	SINCR		1		/* increment of stack/NBPG */
     17  1.5.2.1   thorpej 
     18      1.5  jonathan #define	UPAGES		2		/* pages of u-area */
     19      1.5  jonathan #define	UADDR		0xffffc000	/* address of u */
     20      1.5  jonathan #define USPACE          (UPAGES*NBPG)   /* size of u-area in bytes */
     21      1.5  jonathan #define	UVPN		(UADDR>>PGSHIFT)/* virtual page number of u */
     22      1.5  jonathan #define	KERNELSTACK	(UADDR+UPAGES*NBPG)	/* top of kernel stack */
     23      1.5  jonathan 
     24  1.5.2.2   thorpej #ifndef MSGBUFSIZE
     25  1.5.2.2   thorpej #define MSGBUFSIZE	NBPG		/* default message buffer size */
     26  1.5.2.2   thorpej #endif
     27      1.1  jonathan 
     28      1.1  jonathan /*
     29      1.1  jonathan  * Round p (pointer or byte index) up to a correctly-aligned value for all
     30      1.1  jonathan  * data types (int, long, ...).   The result is u_int and must be cast to
     31      1.1  jonathan  * any desired pointer type.
     32      1.1  jonathan  */
     33      1.1  jonathan #define	ALIGNBYTES	7
     34      1.1  jonathan #define	ALIGN(p)	(((u_int)(p) + ALIGNBYTES) &~ ALIGNBYTES)
     35      1.2  jonathan #define ALIGNED_POINTER(p,t)	((((u_long)(p)) & (sizeof(t)-1)) == 0)
     36      1.1  jonathan 
     37      1.1  jonathan #define	NBPG		4096		/* bytes/page */
     38      1.1  jonathan #define	PGOFSET		(NBPG-1)	/* byte offset into page */
     39      1.1  jonathan #define	PGSHIFT		12		/* LOG2(NBPG) */
     40      1.1  jonathan #define	NPTEPG		(NBPG/4)
     41      1.1  jonathan 
     42      1.1  jonathan #define NBSEG		0x400000	/* bytes/segment */
     43      1.1  jonathan #define	SEGOFSET	(NBSEG-1)	/* byte offset into segment */
     44      1.1  jonathan #define	SEGSHIFT	22		/* LOG2(NBSEG) */
     45      1.1  jonathan 
     46      1.1  jonathan /*
     47      1.1  jonathan  * Size of kernel malloc arena in CLBYTES-sized logical pages
     48      1.1  jonathan  */
     49      1.1  jonathan #ifndef NKMEMCLUSTERS
     50      1.1  jonathan #define	NKMEMCLUSTERS	(512*1024/CLBYTES)
     51      1.1  jonathan #endif
     52      1.1  jonathan 
     53      1.1  jonathan /* pages ("clicks") (4096 bytes) to disk blocks */
     54      1.1  jonathan #define	ctod(x)		((x) << (PGSHIFT - DEV_BSHIFT))
     55      1.1  jonathan #define	dtoc(x)		((x) >> (PGSHIFT - DEV_BSHIFT))
     56      1.1  jonathan 
     57      1.1  jonathan /* pages to bytes */
     58      1.1  jonathan #define	ctob(x)		((x) << PGSHIFT)
     59      1.1  jonathan #define btoc(x)		(((x) + PGOFSET) >> PGSHIFT)
     60      1.1  jonathan 
     61      1.1  jonathan /* bytes to disk blocks */
     62      1.1  jonathan #define	btodb(x)	((x) >> DEV_BSHIFT)
     63      1.1  jonathan #define dbtob(x)	((x) << DEV_BSHIFT)
     64      1.1  jonathan 
     65      1.1  jonathan /*
     66      1.1  jonathan  * Map a ``block device block'' to a file system block.
     67      1.1  jonathan  * This should be device dependent, and should use the bsize
     68      1.1  jonathan  * field from the disk label.
     69      1.1  jonathan  * For now though just use DEV_BSIZE.
     70      1.1  jonathan  */
     71      1.1  jonathan #define	bdbtofsb(bn)	((bn) / (BLKDEV_IOSIZE/DEV_BSIZE))
     72      1.1  jonathan 
     73      1.1  jonathan /*
     74      1.1  jonathan  * Mach derived conversion macros
     75      1.1  jonathan  */
     76      1.1  jonathan #define mips_round_page(x)	((((unsigned)(x)) + NBPG - 1) & ~(NBPG-1))
     77      1.1  jonathan #define mips_trunc_page(x)	((unsigned)(x) & ~(NBPG-1))
     78      1.1  jonathan #define mips_btop(x)		((unsigned)(x) >> PGSHIFT)
     79      1.1  jonathan #define mips_ptob(x)		((unsigned)(x) << PGSHIFT)
     80      1.1  jonathan 
     81      1.1  jonathan #ifdef _KERNEL
     82      1.1  jonathan #ifndef _LOCORE
     83      1.1  jonathan typedef int spl_t;
     84      1.1  jonathan extern spl_t splx __P((spl_t));
     85      1.1  jonathan extern spl_t splsoftnet __P((void)), splsoftclock __P((void));
     86      1.1  jonathan extern spl_t splhigh __P((void));
     87      1.1  jonathan extern spl_t spl0 __P((void));	/* XXX should not enable TC on 3min */
     88      1.1  jonathan 
     89      1.1  jonathan extern void setsoftnet __P((void)), clearsoftnet __P((void));
     90      1.1  jonathan extern void setsoftclock __P((void)), clearsoftclock __P((void));
     91      1.1  jonathan 
     92      1.1  jonathan 
     93      1.1  jonathan extern int (*Mach_splnet) __P((void)), (*Mach_splbio) __P((void)),
     94      1.1  jonathan 	   (*Mach_splimp) __P((void)), (*Mach_spltty) __P((void)),
     95      1.1  jonathan 	   (*Mach_splclock) __P((void)), (*Mach_splstatclock) __P((void)),
     96      1.1  jonathan 	   (*Mach_splnone) __P((void));
     97      1.1  jonathan #define	splnet()	((*Mach_splnet)())
     98      1.1  jonathan #define	splbio()	((*Mach_splbio)())
     99      1.1  jonathan #define	splimp()	((*Mach_splimp)())
    100      1.1  jonathan #define	spltty()	((*Mach_spltty)())
    101      1.1  jonathan #define	splclock()	((*Mach_splclock)())
    102      1.1  jonathan #define	splstatclock()	((*Mach_splstatclock)())
    103      1.1  jonathan 
    104      1.1  jonathan extern void delay __P((int n));
    105  1.5.2.1   thorpej extern int cpuspeed;
    106  1.5.2.1   thorpej #define	DELAY(n)	{ register int N = cpuspeed * (n); while (--N > 0); }
    107  1.5.2.1   thorpej 
    108      1.1  jonathan 
    109  1.5.2.1   thorpej #endif	/* !_LOCORE */
    110      1.1  jonathan #endif	/* _KERNEL */
    111