iwm: Fix S:N reporting in ifconfig(8)
[dragonfly.git] / sys / platform / pc64 / include / vmparam.h
1 /*-
2  * Copyright (c) 1990 The Regents of the University of California.
3  * Copyright (c) 1994 John S. Dyson
4  * Copyright (c) 2003 Peter Wemm
5  * Copyright (c) 2008 The DragonFly Project.
6  * All rights reserved.
7  *
8  * This code is derived from software contributed to Berkeley by
9  * William Jolitz.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions
13  * are met:
14  * 1. Redistributions of source code must retain the above copyright
15  *    notice, this list of conditions and the following disclaimer.
16  * 2. Redistributions in binary form must reproduce the above copyright
17  *    notice, this list of conditions and the following disclaimer in the
18  *    documentation and/or other materials provided with the distribution.
19  * 3. All advertising materials mentioning features or use of this software
20  *    must display the following acknowledgement:
21  *      This product includes software developed by the University of
22  *      California, Berkeley and its contributors.
23  * 4. Neither the name of the University nor the names of its contributors
24  *    may be used to endorse or promote products derived from this software
25  *    without specific prior written permission.
26  *
27  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
28  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
31  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
32  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
33  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
36  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37  * SUCH DAMAGE.
38  *
39  *      from: @(#)vmparam.h     5.9 (Berkeley) 5/12/91
40  * $FreeBSD: src/sys/amd64/include/vmparam.h,v 1.44 2003/12/07 04:51:04 alc Exp $
41  * $DragonFly: src/sys/platform/pc64/include/vmparam.h,v 1.2 2008/08/29 17:07:17 dillon Exp $
42  */
43
44
45 #ifndef _MACHINE_VMPARAM_H_
46 #define _MACHINE_VMPARAM_H_
47
48 /*
49  * Machine dependent constants for x86_64.
50  */
51
52 /*
53  * Virtual memory related constants, all in bytes
54  */
55 #define MAXTSIZ         (32UL*1024*1024*1024)   /* max text size */
56 #ifndef DFLDSIZ
57 #define DFLDSIZ         (128UL*1024*1024)       /* initial data size limit */
58 #endif
59 #ifndef MAXDSIZ
60 #define MAXDSIZ         (32UL*1024*1024*1024)   /* max data size */
61 #endif
62 #ifndef DFLSSIZ
63 #define DFLSSIZ         (8UL*1024*1024)         /* initial stack size limit */
64 #endif
65 #ifndef MAXSSIZ
66 #define MAXSSIZ         (512UL*1024*1024)       /* max stack size */
67 #endif
68 #ifndef MAXTHRSSIZ
69 #define MAXTHRSSIZ      (128UL*1024*1024*1024)  /* thread stack area */
70 #endif
71 #ifndef SGROWSIZ
72 #define SGROWSIZ        (128UL*1024)            /* amount to grow stack */
73 #endif
74
75 /*
76  * The time for a process to be blocked before being very swappable.
77  * This is a number of seconds which the system takes as being a non-trivial
78  * amount of real time.  You probably shouldn't change this;
79  * it is used in subtle ways (fractions and multiples of it are, that is, like
80  * half of a ``long time'', almost a long time, etc.)
81  * It is related to human patience and other factors which don't really
82  * change over time.
83  */
84 #define MAXSLP          20
85
86 /*
87  * We provide a machine specific single page allocator through the use
88  * of the direct mapped segment.  This uses 2MB pages for reduced
89  * TLB pressure.
90  */
91 #define UMA_MD_SMALL_ALLOC
92
93 /*
94  * The number of PHYSSEG entries must be one greater than the number
95  * of phys_avail entries because the phys_avail entry that spans the
96  * largest physical address that is accessible by ISA DMA is split
97  * into two PHYSSEG entries. 
98  */
99 #define VM_PHYSSEG_MAX          127
100
101 /*
102  * Virtual addresses of things.  Derived from the page directory and
103  * page table indexes from pmap.h for precision.
104  * Because of the page that is both a PD and PT, it looks a little
105  * messy at times, but hey, we'll do anything to save a page :-)
106  *
107  * NKPDPE is the number of PD's representing KVM.  Not all are immediately
108  * populated.  There are 512 PD's per PDP and the value is calculated from
109  * NKPML4E (see pmap.h).
110  *
111  * The ending address is non-inclusive of the per-cpu data array
112  * which starts at MPPTDI (-16MB mark).  MPPTDI is the page directory
113  * index in the last PD of the kernel address space and is typically
114  * set to (NPDEPG - 8) = (512 - 8).
115  */
116 #define NKPDPE                  (NKPML4E*NPDPEPG-1)
117 #define KPDPPHYS_KVA            KVADDR(KPML4I, 0, 0, 0)
118 #define VM_MIN_KERNEL_ADDRESS   KVADDR(KPML4I, NKPML4E*NPDPEPG - NKPDPE, 0, 0)
119 #define VM_MAX_KERNEL_ADDRESS   KVADDR(KPML4I + NKPML4E - 1,            \
120                                         NPDPEPG - 1, MPPTDI, NPTEPG - 1)
121
122 #define DMAP_MIN_ADDRESS        KVADDR(DMPML4I, 0, 0, 0)
123 #define DMAP_MAX_ADDRESS        KVADDR(DMPML4I+NDMPML4E, 0, 0, 0)
124
125 #define KERNBASE                KVADDR(KPML4I + NKPML4E - 1, KPDPI, 0, 0)
126 #define PTOV_OFFSET             KERNBASE
127
128 #define UPT_MAX_ADDRESS         KVADDR(PML4PML4I, PML4PML4I, PML4PML4I, PML4PML4I)
129 #define UPT_MIN_ADDRESS         KVADDR(PML4PML4I, 0, 0, 0)
130
131 /*
132  * Do not allow the top 2MB of the user stack to be mapped to work around
133  * an AMD bug wherein the cpu can lockup or destabilize if the instruction
134  * prefetcher crosses over into non-canonical address space.  Only the top
135  * 4KB needs to be disallowed, but taking out the whole 2MB allows potential
136  * 2MB PTE optimizations to be retained.
137  */
138 #define VM_MIN_USER_ADDRESS     ((vm_offset_t)0)
139 #define VM_MAX_USER_ADDRESS     UVADDR(NUPDP_USER - 1, NPDPEPG - 1, \
140                                         NPDEPG - 1, 0)
141
142 #define USRSTACK                VM_MAX_USER_ADDRESS
143
144 #define VM_MAX_ADDRESS          UPT_MAX_ADDRESS
145 #define VM_MIN_ADDRESS          (0)
146
147 #define PHYS_TO_DMAP(x)         ((vm_offset_t)(x) + DMAP_MIN_ADDRESS)
148 #define DMAP_TO_PHYS(x)         ((vm_paddr_t)(x) - DMAP_MIN_ADDRESS)
149
150 /* initial pagein size of beginning of executable file */
151 #ifndef VM_INITIAL_PAGEIN
152 #define VM_INITIAL_PAGEIN       16
153 #endif
154
155 #endif /* _MACHINE_VMPARAM_H_ */