4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
22 * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
34 * Kernel Physical Mapping (segkpm) segment driver.
40 ushort_t
*skd_va_select
; /* page_create_va kpm vaddr bin count */
41 short skd_nvcolors
; /* VAC colors to deal with */
46 * segkpm create needs some platform knowledge
48 struct segkpm_crargs
{
50 short nvcolors
; /* VAC # virtual colors, 0 for PAC. */
53 extern struct seg
*segkpm
;
54 extern uoff_t kpm_pgoff
;
55 extern size_t kpm_pgsz
;
56 extern uint_t kpm_pgshft
;
57 extern uint_t kpmp2pshft
;
58 extern pgcnt_t kpmpnpgs
;
61 extern int kpm_enable
;
62 extern int kpm_smallpages
;
63 extern int segmap_kpm
;
67 * . bytes (b) to kpm pages (kpmp)
68 * . pages (p) to kpm pages (kpmp), and back (with and without roundup)
69 * . kpm page offset in bytes
70 * . pages (p) modulo kpm pages (kpmp)
72 #define btokpmp(x) ((x) >> kpm_pgshft)
73 #define btokpmpr(x) (((x) + kpm_pgoff) >> kpm_pgshft)
74 #define ptokpmp(x) ((x) >> kpmp2pshft)
75 #define ptokpmpr(x) (((x) + (kpmpnpgs - 1)) >> kpmp2pshft)
76 #define kpmptop(x) ((x) << kpmp2pshft)
77 #define kpmpageoff(x) ((x) & kpm_pgoff)
78 #define pmodkpmp(x) ((x) & (kpmpnpgs - 1))
82 #define IS_KPM_ADDR(addr) \
83 ((addr) >= segkpm->s_base && (addr) < (segkpm->s_base + segkpm->s_size))
86 /* x86 systems use neither kpm_page_t nor kpm_spage_t when supporting kpm. */
87 #define KPMPAGE_T_SZ (0)
89 #define KPMPAGE_T_SZ \
90 ((kpm_smallpages == 0) ? sizeof (kpm_page_t) : sizeof (kpm_spage_t))
93 #else /* SEGKPM_SUPPORT */
95 #define IS_KPM_ADDR(addr) (segkpm != NULL)
96 #define KPMPAGE_T_SZ (0)
98 #endif /* SEGKPM_SUPPORT */
102 * Public seg_kpm segment operations.
104 extern int segkpm_create(struct seg
*, void *);
105 extern faultcode_t
segkpm_fault(struct hat
*, struct seg
*, caddr_t
,
106 size_t, enum fault_type
, enum seg_rw
);
109 * Public seg_kpm interfaces.
111 extern caddr_t
segkpm_create_va(uoff_t
);
112 extern void segkpm_mapout_validkpme(struct kpme
*);
120 #endif /* _VM_SEG_KPM_H */