xref: /titanic_41/usr/src/uts/sun4u/sys/zuluvm.h (revision d24234c24aeaca4ca56ee3ac2794507968f274c4)
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	__ZULUVM_INCL__
28 #define	__ZULUVM_INCL__
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 /* zulud interface */
37 
38 #ifndef _ASM
39 
40 #include <sys/dditypes.h>
41 
42 typedef struct {
43 	caddr_t	addr;
44 	size_t  len;
45 	int	tlbtype;
46 } zulud_preload_t;
47 
48 typedef struct {
49 	int version;
50 	int (*set_itlb_pc)(void *handle, uint64_t mondo);
51 	int (*set_dtlb_pc)(void *handle, uint64_t mondo);
52 	int (*set_suspendAck_pc)(void *handle, uint64_t mondo);
53 	int (*write_tte)(void *handle, int ttesize, uint64_t tag,
54 	    pfn_t pfn, int permission, int tlbtype);
55 	int (*tlb_done)(void *handle, int tlbtype, int status);
56 	int (*demap_page)(void *handle, caddr_t vaddr, short ctx);
57 	int (*demap_ctx)(void *handle, short ctx);
58 	int (*dma_suspend_ack)(void *handle);
59 	int (*set_tsb)(void *handle, int tlbtype, uint64_t tsbreg);
60 } zulud_ops_t;
61 
62 #endif
63 
64 #define	ZULUVM_SUCCESS		0
65 #define	ZULUVM_ERROR		1
66 #define	ZULUVM_NO_TTE		2
67 #define	ZULUVM_INVALID_MISS	3
68 #define	ZULUVM_NO_DEV		4
69 #define	ZULUVM_NO_HAT		5
70 #define	ZULUVM_NO_MAP		6
71 #define	ZULUVM_VERSION_MISMATCH	7
72 #define	ZULUVM_TTE_DELAY	8
73 #define	ZULUVM_MISS_CANCELED	9
74 #define	ZULUVM_BAD_IDX		10
75 #define	ZULUVM_WATCH_POINT	11
76 #define	ZULUVM_NO_SUPPORT	12
77 #define	ZULUVM_CTX_LOCKED	13
78 
79 #define	ZULUVM_ITLB_FLAG	0x1
80 #define	ZULUVM_DMA_FLAG		0x2
81 #define	ZULUVM_DMA_MASK		0x3
82 
83 #define	ZULUVM_DMA1	0
84 #define	ZULUVM_DMA2	ZULUVM_DMA_FLAG
85 #define	ZULUVM_ITLB1	ZULUVM_ITLB_FLAG
86 #define	ZULUVM_ITLB2	(ZULUVM_ITLB_FLAG | ZULUVM_DMA_FLAG)
87 #define	ZULUVM_INVAL	0x4
88 
89 #ifndef _ASM
90 
91 /* zuluvm interface */
92 
93 #define	ZULUVM_INTERFACE_VERSION	1 /* inc with every intf change */
94 
95 typedef void * zuluvm_info_t;
96 int zuluvm_init(zulud_ops_t *ops, int **pagesizes);
97 int zuluvm_fini(void);
98 int zuluvm_alloc_device(dev_info_t *devi, void *arg, zuluvm_info_t *devp,
99     caddr_t mmu, caddr_t imr);
100 int zuluvm_free_device(zuluvm_info_t devp);
101 int zuluvm_dma_add_proc(zuluvm_info_t devp, uint64_t *cookie);
102 int zuluvm_dma_delete_proc(zuluvm_info_t devp, uint64_t cookie);
103 int zuluvm_dma_alloc_ctx(zuluvm_info_t devp, int dma, short *ctx,
104     uint64_t *tsb);
105 int zuluvm_dma_preload(zuluvm_info_t devp, int dma, int num,
106     zulud_preload_t *list);
107 int zuluvm_dma_free_ctx(zuluvm_info_t devp, int dma);
108 int zuluvm_add_intr(zuluvm_info_t devp, int ino, uint_t (*handler)(caddr_t),
109     caddr_t arg);
110 int zuluvm_rem_intr(zuluvm_info_t devp, int ino);
111 int zuluvm_enable_intr(zuluvm_info_t devp, int num);
112 int zuluvm_disable_intr(zuluvm_info_t devp, int num);
113 int zuluvm_park(zuluvm_info_t devp);
114 
115 #endif
116 
117 #ifdef	__cplusplus
118 }
119 #endif
120 
121 #endif	/* __ZULUVM_INCL__ */
122