Home | History | Annotate | Line # | Download | only in include
param.h revision 1.18
      1 /*	$NetBSD: param.h,v 1.18 2012/04/20 22:23:24 rmind Exp $	*/
      2 
      3 #ifdef __x86_64__
      4 
      5 #ifndef XEN
      6 /* Must be defined before cpu.h */
      7 #define	MAXCPUS		256
      8 #endif
      9 
     10 #ifdef _KERNEL
     11 #include <machine/cpu.h>
     12 #endif
     13 
     14 #define	_MACHINE	amd64
     15 #define	MACHINE		"amd64"
     16 #define	_MACHINE_ARCH	x86_64
     17 #define	MACHINE_ARCH	"x86_64"
     18 #define MID_MACHINE	MID_X86_64
     19 
     20 #define ALIGNED_POINTER(p,t)	1
     21 
     22 #define ALIGNBYTES32		(sizeof(int) - 1)
     23 #define ALIGN32(p)		(((u_long)(p) + ALIGNBYTES32) &~ALIGNBYTES32)
     24 
     25 #define	PGSHIFT		12		/* LOG2(NBPG) */
     26 #define	NBPG		(1 << PGSHIFT)	/* bytes/page */
     27 #define	PGOFSET		(NBPG-1)	/* byte offset into page */
     28 #define	NPTEPG		(NBPG/(sizeof (pt_entry_t)))
     29 
     30 /*
     31  * XXXfvdl change this (after bootstrap) to take # of bits from
     32  * config info into account.
     33  */
     34 #define	KERNBASE	0xffffffff80000000 /* start of kernel virtual space */
     35 #define	KERNTEXTOFF	0xffffffff80100000 /* start of kernel text */
     36 #define	BTOPKERNBASE	((u_long)KERNBASE >> PGSHIFT)
     37 
     38 #define KERNTEXTOFF_HI	0xffffffff
     39 #define KERNTEXTOFF_LO	0x80100000
     40 
     41 #define KERNBASE_HI	0xffffffff
     42 #define KERNBASE_LO	0x80000000
     43 
     44 #define	DEV_BSHIFT	9		/* log2(DEV_BSIZE) */
     45 #define	DEV_BSIZE	(1 << DEV_BSHIFT)
     46 #define	BLKDEV_IOSIZE	2048
     47 #ifndef	MAXPHYS
     48 #define	MAXPHYS		(64 * 1024)	/* max raw I/O transfer size */
     49 #endif
     50 
     51 #define	SSIZE		1		/* initial stack size/NBPG */
     52 #define	SINCR		1		/* increment of stack/NBPG */
     53 #ifdef DIAGNOSTIC
     54 #define	UPAGES		4		/* pages of u-area (1 for redzone) */
     55 #else
     56 #define	UPAGES		3		/* pages of u-area */
     57 #endif
     58 #define	USPACE		(UPAGES * NBPG)	/* total size of u-area */
     59 #define	INTRSTACKSIZE	4096
     60 
     61 #ifndef MSGBUFSIZE
     62 #define MSGBUFSIZE	8*NBPG		/* default message buffer size */
     63 #endif
     64 
     65 /*
     66  * Constants related to network buffer management.
     67  * MCLBYTES must be no larger than NBPG (the software page size), and,
     68  * on machines that exchange pages of input or output buffers with mbuf
     69  * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple
     70  * of the hardware page size.
     71  */
     72 #define	MSIZE		512		/* size of an mbuf */
     73 
     74 #ifndef MCLSHIFT
     75 #define	MCLSHIFT	11		/* convert bytes to m_buf clusters */
     76 					/* 2K cluster can hold Ether frame */
     77 #endif	/* MCLSHIFT */
     78 
     79 #define	MCLBYTES	(1 << MCLSHIFT)	/* size of a m_buf cluster */
     80 
     81 #ifndef NFS_RSIZE
     82 #define NFS_RSIZE       32768
     83 #endif
     84 #ifndef NFS_WSIZE
     85 #define NFS_WSIZE       32768
     86 #endif
     87 
     88 /*
     89  * Minimum size of the kernel kmem_arena in PAGE_SIZE-sized
     90  * logical pages.
     91  * No enforced maximum on amd64.
     92  */
     93 #define	NKMEMPAGES_MIN_DEFAULT	((8 * 1024 * 1024) >> PAGE_SHIFT)
     94 #define	NKMEMPAGES_MAX_UNLIMITED 1
     95 
     96 /*
     97  * XXXfvdl the PD* stuff is different from i386.
     98  */
     99 /*
    100  * Mach derived conversion macros
    101  */
    102 #define	x86_round_pdr(x) \
    103 	((((unsigned long)(x)) + (NBPD_L2 - 1)) & ~(NBPD_L2 - 1))
    104 #define	x86_trunc_pdr(x)	((unsigned long)(x) & ~(NBPD_L2 - 1))
    105 #define	x86_btod(x)		((unsigned long)(x) >> L2_SHIFT)
    106 #define	x86_dtob(x)		((unsigned long)(x) << L2_SHIFT)
    107 #define	x86_round_page(x)	((((unsigned long)(x)) + PGOFSET) & ~PGOFSET)
    108 #define	x86_trunc_page(x)	((unsigned long)(x) & ~PGOFSET)
    109 #define	x86_btop(x)		((unsigned long)(x) >> PGSHIFT)
    110 #define	x86_ptob(x)		((unsigned long)(x) << PGSHIFT)
    111 
    112 #define btop(x)				x86_btop(x)
    113 #define ptob(x)				x86_ptob(x)
    114 
    115 #define mstohz(ms) ((ms + 0UL) * hz / 1000)
    116 
    117 #else	/*	__x86_64__	*/
    118 
    119 #include <i386/param.h>
    120 
    121 #endif	/*	__x86_64__	*/
    122