summaryrefslogtreecommitdiff
path: root/usr/src/uts/sun4u/sys/zuluvm.h
blob: d36a63b9bc708e60027d160c1ad074a791562ed3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
 * or http://www.opensolaris.org/os/licensing.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
 * If applicable, add the following below this CDDL HEADER, with the
 * fields enclosed by brackets "[]" replaced with your own identifying
 * information: Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 */
/*
 * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
 * Use is subject to license terms.
 */

#ifndef	__ZULUVM_INCL__
#define	__ZULUVM_INCL__

#pragma ident	"%Z%%M%	%I%	%E% SMI"

#ifdef	__cplusplus
extern "C" {
#endif

/* zulud interface */

#ifndef _ASM

#include <sys/dditypes.h>

typedef struct {
	caddr_t	addr;
	size_t  len;
	int	tlbtype;
} zulud_preload_t;

typedef struct {
	int version;
	int (*set_itlb_pc)(void *handle, uint64_t mondo);
	int (*set_dtlb_pc)(void *handle, uint64_t mondo);
	int (*set_suspendAck_pc)(void *handle, uint64_t mondo);
	int (*write_tte)(void *handle, int ttesize, uint64_t tag,
	    pfn_t pfn, int permission, int tlbtype);
	int (*tlb_done)(void *handle, int tlbtype, int status);
	int (*demap_page)(void *handle, caddr_t vaddr, short ctx);
	int (*demap_ctx)(void *handle, short ctx);
	int (*dma_suspend_ack)(void *handle);
	int (*set_tsb)(void *handle, int tlbtype, uint64_t tsbreg);
} zulud_ops_t;

#endif

#define	ZULUVM_SUCCESS		0
#define	ZULUVM_ERROR		1
#define	ZULUVM_NO_TTE		2
#define	ZULUVM_INVALID_MISS	3
#define	ZULUVM_NO_DEV		4
#define	ZULUVM_NO_HAT		5
#define	ZULUVM_NO_MAP		6
#define	ZULUVM_VERSION_MISMATCH	7
#define	ZULUVM_TTE_DELAY	8
#define	ZULUVM_MISS_CANCELED	9
#define	ZULUVM_BAD_IDX		10
#define	ZULUVM_WATCH_POINT	11
#define	ZULUVM_NO_SUPPORT	12
#define	ZULUVM_CTX_LOCKED	13

#define	ZULUVM_ITLB_FLAG	0x1
#define	ZULUVM_DMA_FLAG		0x2
#define	ZULUVM_DMA_MASK		0x3

#define	ZULUVM_DMA1	0
#define	ZULUVM_DMA2	ZULUVM_DMA_FLAG
#define	ZULUVM_ITLB1	ZULUVM_ITLB_FLAG
#define	ZULUVM_ITLB2	(ZULUVM_ITLB_FLAG | ZULUVM_DMA_FLAG)
#define	ZULUVM_INVAL	0x4

#ifndef _ASM

/* zuluvm interface */

#define	ZULUVM_INTERFACE_VERSION	1 /* inc with every intf change */

typedef void * zuluvm_info_t;
int zuluvm_init(zulud_ops_t *ops, int **pagesizes);
int zuluvm_fini(void);
int zuluvm_alloc_device(dev_info_t *devi, void *arg, zuluvm_info_t *devp,
    caddr_t mmu, caddr_t imr);
int zuluvm_free_device(zuluvm_info_t devp);
int zuluvm_dma_add_proc(zuluvm_info_t devp, uint64_t *cookie);
int zuluvm_dma_delete_proc(zuluvm_info_t devp, uint64_t cookie);
int zuluvm_dma_alloc_ctx(zuluvm_info_t devp, int dma, short *ctx,
    uint64_t *tsb);
int zuluvm_dma_preload(zuluvm_info_t devp, int dma, int num,
    zulud_preload_t *list);
int zuluvm_dma_free_ctx(zuluvm_info_t devp, int dma);
int zuluvm_add_intr(zuluvm_info_t devp, int ino, uint_t (*handler)(caddr_t),
    caddr_t arg);
int zuluvm_rem_intr(zuluvm_info_t devp, int ino);
int zuluvm_enable_intr(zuluvm_info_t devp, int num);
int zuluvm_disable_intr(zuluvm_info_t devp, int num);
int zuluvm_park(zuluvm_info_t devp);

#endif

#ifdef	__cplusplus
}
#endif

#endif	/* __ZULUVM_INCL__ */