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