Home | History | Annotate | Line # | Download | only in include
mips_param.h revision 1.1
      1 /*	$NetBSD: mips_param.h,v 1.1 1996/05/19 17:52:18 jonathan Exp $	*/
      2 
      3 /*
      4  * Round p (pointer or byte index) up to a correctly-aligned value for all
      5  * data types (int, long, ...).   The result is u_int and must be cast to
      6  * any desired pointer type.
      7  */
      8 #define	ALIGNBYTES	7
      9 #define	ALIGN(p)	(((u_int)(p) + ALIGNBYTES) &~ ALIGNBYTES)
     10 
     11 #define	NBPG		4096		/* bytes/page */
     12 #define	PGOFSET		(NBPG-1)	/* byte offset into page */
     13 #define	PGSHIFT		12		/* LOG2(NBPG) */
     14 #define	NPTEPG		(NBPG/4)
     15 
     16 #define NBSEG		0x400000	/* bytes/segment */
     17 #define	SEGOFSET	(NBSEG-1)	/* byte offset into segment */
     18 #define	SEGSHIFT	22		/* LOG2(NBSEG) */
     19 
     20 /*
     21  * Size of kernel malloc arena in CLBYTES-sized logical pages
     22  */
     23 #ifndef NKMEMCLUSTERS
     24 #define	NKMEMCLUSTERS	(512*1024/CLBYTES)
     25 #endif
     26 
     27 /* pages ("clicks") (4096 bytes) to disk blocks */
     28 #define	ctod(x)		((x) << (PGSHIFT - DEV_BSHIFT))
     29 #define	dtoc(x)		((x) >> (PGSHIFT - DEV_BSHIFT))
     30 
     31 /* pages to bytes */
     32 #define	ctob(x)		((x) << PGSHIFT)
     33 #define btoc(x)		(((x) + PGOFSET) >> PGSHIFT)
     34 
     35 /* bytes to disk blocks */
     36 #define	btodb(x)	((x) >> DEV_BSHIFT)
     37 #define dbtob(x)	((x) << DEV_BSHIFT)
     38 
     39 /*
     40  * Map a ``block device block'' to a file system block.
     41  * This should be device dependent, and should use the bsize
     42  * field from the disk label.
     43  * For now though just use DEV_BSIZE.
     44  */
     45 #define	bdbtofsb(bn)	((bn) / (BLKDEV_IOSIZE/DEV_BSIZE))
     46 
     47 /*
     48  * Mach derived conversion macros
     49  */
     50 #define mips_round_page(x)	((((unsigned)(x)) + NBPG - 1) & ~(NBPG-1))
     51 #define mips_trunc_page(x)	((unsigned)(x) & ~(NBPG-1))
     52 #define mips_btop(x)		((unsigned)(x) >> PGSHIFT)
     53 #define mips_ptob(x)		((unsigned)(x) << PGSHIFT)
     54 
     55 #ifdef _KERNEL
     56 #ifndef _LOCORE
     57 typedef int spl_t;
     58 extern spl_t splx __P((spl_t));
     59 extern spl_t splsoftnet __P((void)), splsoftclock __P((void));
     60 extern spl_t splhigh __P((void));
     61 extern spl_t spl0 __P((void));	/* XXX should not enable TC on 3min */
     62 
     63 extern void setsoftnet __P((void)), clearsoftnet __P((void));
     64 extern void setsoftclock __P((void)), clearsoftclock __P((void));
     65 
     66 
     67 extern int (*Mach_splnet) __P((void)), (*Mach_splbio) __P((void)),
     68 	   (*Mach_splimp) __P((void)), (*Mach_spltty) __P((void)),
     69 	   (*Mach_splclock) __P((void)), (*Mach_splstatclock) __P((void)),
     70 	   (*Mach_splnone) __P((void));
     71 #define	splnet()	((*Mach_splnet)())
     72 #define	splbio()	((*Mach_splbio)())
     73 #define	splimp()	((*Mach_splimp)())
     74 #define	spltty()	((*Mach_spltty)())
     75 #define	splclock()	((*Mach_splclock)())
     76 #define	splstatclock()	((*Mach_splstatclock)())
     77 
     78 extern void wbflush __P ((void));		/* XXX */
     79 extern void delay __P((int n));
     80 
     81 #endif	/* _LOCORE */
     82 #endif	/* _KERNEL */
     83