]> git.saurik.com Git - apple/xnu.git/blob - osfmk/i386/AT386/himem.h
ca5a3f7e0e67bd8a0ce2d7989ff6f091c75380e0
[apple/xnu.git] / osfmk / i386 / AT386 / himem.h
1 /*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23 /*
24 * @OSF_FREE_COPYRIGHT@
25 */
26 /*
27 * HISTORY
28 *
29 * Revision 1.1.1.1 1998/09/22 21:05:38 wsanchez
30 * Import of Mac OS X kernel (~semeria)
31 *
32 * Revision 1.1.1.1 1998/03/07 02:25:39 wsanchez
33 * Import of OSF Mach kernel (~mburg)
34 *
35 * Revision 1.3.11.4 1995/12/15 10:49:49 bernadat
36 * cbus includes moved to busses/cbus
37 * [95/12/15 bernadat]
38 *
39 * Revision 1.3.11.3 1995/08/21 20:33:23 devrcs
40 * ri-osc CR1547: Fix himem buffer translation to cope with non
41 * page-aligned addresses.
42 * [1995/08/08 16:52:06 bolinger]
43 *
44 * Revision 1.3.11.2 1995/01/26 22:14:56 ezf
45 * removed extraneous CMU CR
46 * [1995/01/26 20:24:48 ezf]
47 *
48 * Revision 1.3.9.2 1994/06/08 21:14:27 dswartz
49 * Preemption merge.
50 * [1994/06/08 21:12:31 dswartz]
51 *
52 * Revision 1.3.9.1 1994/05/19 20:30:30 dwm
53 * mk6 CR 80. Add himem_init prototype.
54 * [1994/05/19 20:30:10 dwm]
55 *
56 * Revision 1.3.2.3 1993/08/09 19:37:21 dswartz
57 * Add ANSI prototypes - CR#9523
58 * [1993/08/06 17:50:06 dswartz]
59 *
60 * Revision 1.3.2.2 1993/06/09 02:25:24 gm
61 * CR9176 - ANSI C violations: trailing tokens on CPP
62 * directives, extra semicolons after decl_ ..., asm keywords
63 * [1993/06/07 18:58:40 jeffc]
64 *
65 * Added to OSF/1 R1.3 from NMK15.0.
66 * [1993/06/02 21:01:57 jeffc]
67 *
68 * Revision 1.3 1993/04/19 16:09:54 devrcs
69 * Use free copyright
70 * [1993/03/03 12:12:12 bernadat]
71 *
72 * Revision 1.2 1992/11/25 01:07:16 robert
73 * integrate changes below for norma_14
74 * [1992/11/13 19:28:57 robert]
75 *
76 * $EndLog$
77 */
78
79 #ifndef _I386AT_HIMEM_H_
80 #define _I386AT_HIMEM_H_
81
82 /*
83 * support of memory above 16 Megs for DMA limited to memory
84 * below 16 Megs.
85 */
86
87 #include <platforms.h>
88
89 #define HIMEM_STATS 0
90
91 #if HIMEM_STATS
92 extern int himem_request;
93 extern int himem_used;
94 #endif /* HIMEM_STATS */
95
96 struct himem_link {
97 struct himem_link *next;
98 vm_offset_t high_addr; /* physical address */
99 vm_offset_t low_page; /* physical page */
100 vm_offset_t offset; /* offset on page */
101 vm_size_t length;
102 };
103
104 typedef struct himem_link *hil_t;
105
106
107 #define HIGH_MEM ((vm_offset_t) 0xf00000)
108
109 #define _high_mem_page(x) ((vm_offset_t)(x) >= HIGH_MEM)
110
111
112 #if HIMEM_STATS
113 #define high_mem_page(x) \
114 (++himem_request && _high_mem_page(x) && ++himem_used)
115
116 #else /* HIMEM_STATS */
117 #define high_mem_page(x) _high_mem_page(x)
118 #endif /* HIMEM_STATS */
119
120 extern void himem_init(void);
121 extern void himem_reserve(
122 int npages);
123 extern vm_offset_t himem_convert(
124 vm_offset_t paddr,
125 vm_size_t len,
126 int op,
127 hil_t * hil);
128 extern void himem_revert(
129 hil_t hil);
130
131 #endif /* _I386AT_HIMEM_H_ */