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