summaryrefslogtreecommitdiff
path: root/usr/src/uts/sun4u/starcat/sys/iosramio.h
blob: 2c04c7ee673655bd0fa58dc44689104570b2fbd9 (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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License (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 2000 Sun Microsystems, Inc.  All rights reserved.
 * Use is subject to license terms.
 */

#ifndef	_SYS_IOSRAMIO_H
#define	_SYS_IOSRAMIO_H

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

#ifdef	__cplusplus
extern "C" {
#endif


/*
 * data_valid flag values
 */
#define	IOSRAM_DATA_INVALID	0
#define	IOSRAM_DATA_VALID	1

/*
 * int_pending flag values
 */
#define	IOSRAM_INT_NONE		0
#define	IOSRAM_INT_TO_SSC	1
#define	IOSRAM_INT_TO_DOM	2

/*
 * IOSRAM control commands, for use in iosram_ctrl().
 */
#define	IOSRAM_CMD_CHUNKLEN			1

/*
 * IOSRAM header control commands, for use in iosram_hdr_ctrl _only_ by the
 * Mailbox Protocol implementation
 */
#define	IOSRAM_HDRCMD_GET_SMS_MBOX_VER		1
#define	IOSRAM_HDRCMD_SET_OS_MBOX_VER		2
#define	IOSRAM_HDRCMD_REG_CALLBACK		3

/*
 * Extern prototypes for kernel drivers/modules
 */
extern int iosram_rd(uint32_t key, uint32_t off, uint32_t len, caddr_t dptr);
extern int iosram_wr(uint32_t key, uint32_t off, uint32_t len, caddr_t dptr);
extern int iosram_force_write(uint32_t key, uint32_t off, uint32_t len,
	caddr_t dptr);
extern int iosram_get_flag(uint32_t key, uint8_t *data_valid,
	uint8_t *int_pending);
extern int iosram_set_flag(uint32_t key, uint8_t data_valid,
	uint8_t int_pending);
extern int iosram_send_intr();
extern int iosram_register(uint32_t key, void (*handler)(), void *arg);
extern int iosram_unregister(uint32_t key);
extern int iosram_ctrl(uint32_t key, uint32_t cmd, void *arg);

/*
 * This function is only intended to be called by DR.
 */
extern int iosram_switchfrom(int instance);

/*
 * The following functions are only to be used by the Mailbox Protocol
 * implementation.
 */
extern int iosram_sema_acquire(uint32_t *);
extern int iosram_sema_release(void);
extern int iosram_hdr_ctrl(uint32_t cmd, void *arg);


#if defined(DEBUG)

/*
 * ioctls for testing purposes only
 */

#define	IOSRAM_IOC			('i' << 8)

#define	IOSRAM_RD		(int)(IOSRAM_IOC|1)
#define	IOSRAM_WR		(int)(IOSRAM_IOC|2)
#define	IOSRAM_GET_FLAG		(int)(IOSRAM_IOC|3)
#define	IOSRAM_SET_FLAG		(int)(IOSRAM_IOC|4)
#define	IOSRAM_TOC		(int)(IOSRAM_IOC|5)
#define	IOSRAM_SEND_INTR	(int)(IOSRAM_IOC|6)
#define	IOSRAM_REG_CBACK	(int)(IOSRAM_IOC|7)
#define	IOSRAM_UNREG_CBACK	(int)(IOSRAM_IOC|8)
#define	IOSRAM_PRINT_CBACK	(int)(IOSRAM_IOC|9)
#define	IOSRAM_PRINT_STATE	(int)(IOSRAM_IOC|10)
#define	IOSRAM_PRINT_LOG	(int)(IOSRAM_IOC|11)
#define	IOSRAM_PRINT_FLAGS	(int)(IOSRAM_IOC|12)
#define	IOSRAM_TUNNEL_SWITCH	(int)(IOSRAM_IOC|13)
#define	IOSRAM_PRINT_STATS	(int)(IOSRAM_IOC|14)
#define	IOSRAM_SEMA_ACQUIRE	(int)(IOSRAM_IOC|15)
#define	IOSRAM_SEMA_RELEASE	(int)(IOSRAM_IOC|16)


/*
 * struct iosram_io:
 *	Used for testing purposes to invoke IOSRAM internal
 *	interface from user level via ioctl() interface.
 */
typedef struct iosram_io {
	uint32_t cmd;		/* read or write */
	uint32_t key;		/* IOSRAM chunk key */
	uint32_t off;		/* offset within IOSRAM chunk */
	uint32_t len;		/* size of read or write */
	uint32_t bufp;		/* buffer pointer */
	uint32_t retval;	/* provided by driver */
	uint32_t data_valid;	/* flag being get/set */
	uint32_t int_pending;	/* flag being get/set */
} iosram_io_t;

#endif /* DEBUG */

#ifdef	__cplusplus
}
#endif

#endif	/* _SYS_IOSRAMIO_H */