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