xref: /titanic_44/usr/src/uts/sfmmu/vm/xhat_sfmmu.h (revision 45405cce0657d01714b3d014a0facf3bdce45736)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _XHAT_SFMMU_H
28 #define	_XHAT_SFMMU_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 
33 
34 #ifdef	__cplusplus
35 extern "C" {
36 #endif
37 
38 #ifndef _ASM
39 
40 #include <sys/types.h>
41 #include <sys/sysmacros.h>
42 #include <vm/hat_sfmmu.h>
43 #include <vm/page.h>
44 #include <vm/xhat.h>
45 
46 struct xhat;
47 struct xhat_hme_blk;
48 
49 
50 /*
51  * Pads to align xhat_hme_blk's xhat_hme_blk_misc
52  * and with xblk_hme with corresponding fields in
53  * those of hme_blk.
54  */
55 #define	XHAT_PADHI	(offsetof(struct hme_blk, hblk_misc) - \
56 			    sizeof (struct xhat *))
57 
58 #define	XHAT_PADLO	(offsetof(struct hme_blk, hblk_hme[0]) - \
59 				(offsetof(struct hme_blk, hblk_misc) + \
60 					sizeof (struct hme_blk_misc)))
61 
62 /*
63  * This (or, rather, xblk_hme[] member of the structure) is
64  * what gets put on page's p_mappings list.
65  */
66 struct xhat_hme_blk {
67 	struct xhat		*xhat_hme_blk_hat;
68 	char			xblk_pad1[XHAT_PADHI];
69 	struct hme_blk_misc	xhat_hme_blk_misc;
70 	char			xblk_pad2[XHAT_PADLO];
71 	struct sf_hment		xblk_hme[1];
72 };
73 
74 /*
75  * Convert pointers between xhat_hme_blk and provider's
76  * block (these two blocks are always allocated adjacent to
77  * each other).
78  */
79 #define	XBLK2PROVBLK(xblk)	((void *)(((struct xhat_hme_blk *)(xblk)) + 1))
80 #define	PROVBLK2XBLK(pblk)	(((struct xhat_hme_blk *)(pblk)) - 1)
81 
82 
83 
84 void	xhat_xblkcache_reclaim(void *);
85 
86 
87 
88 #endif /* _ASM */
89 
90 #ifdef	__cplusplus
91 }
92 #endif
93 
94 #endif	/* _XHAT_SFMMU_H */
95