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