summaryrefslogtreecommitdiff
path: root/usr/src/uts/sun4u/sys/wrsm_intr.h
blob: 00792dcbb6e99a5e1720712446e29fb1d0b1bd32 (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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
/*
 * 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 (c) 2001 by Sun Microsystems, Inc.
 * All rights reserved.
 */

#ifndef	_WRSM_INTR_H
#define	_WRSM_INTR_H

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

#ifndef _ASM

#include <sys/wrsm_common.h>
#include <sys/wrsm_cmmu.h>
#include <sys/processor.h>
#include <sys/rsm/rsmpi.h>

#endif /* _ASM */

#ifdef __cplusplus
extern "C" {
#endif

/* Limit for rsm_intr_t */
#define	WRSM_INTR_TYPE_MAX	RSM_INTR_T_NSVC
#define	WRSM_TL_INTR_TYPE	(RSM_INTR_T_DRV_BASE + 1) /* transport */
#define	WRSM_SMPUT_INTR_TYPE	(RSM_INTR_T_DRV_BASE + 2) /* small put */

/* Flags for wrsm_intr_create_recvq */
#define	WRSM_CREATE_RECVQ_NOFLAGS	0x0
#define	WRSM_CREATE_RECVQ_SLEEP		0x1
#define	WRSM_CREATE_RECVQ_USER		0x2
#define	WRSM_CREATE_RECVQ_INVALID	0x4

/* Default value for is_wait in wrsm_intr_send() */
#define	WRSM_INTR_WAIT_DEFAULT	-1

#ifndef _ASM

/*
 * Receive Queue structures
 */
struct wrsm_intr_recvq;
typedef struct wrsm_intr_recvq wrsm_intr_recvq_t;

/*
 * Client functions
 */

/* Initialize the interrupt component for this network */
int wrsm_intr_init(wrsm_network_t *);

/* Destroy the interrupt component for this network */
void wrsm_intr_fini(wrsm_network_t *);

/* The following prints all intr data structures, for debug only */
void wrsm_intr_print(wrsm_network_t *);

/*
 * WCI Functions
 */

/* Inform the interrupt component of a new WCI. Returns -1 if add_intr fails */
int wrsm_intr_newwci(wrsm_network_t *, lcwci_handle_t);

/* Inform the interrupt component that a WCI is going away */
void wrsm_intr_delwci(wrsm_network_t *, lcwci_handle_t);

/*
 * Handler Management Functions
 */

/* Registers a handler for a specific interrupt type - rsmpi function */
int wrsmrsm_register_handler(rsm_controller_handle_t,
    rsm_controller_object_t *controller_obj, rsm_intr_t type, rsm_intr_hand_t,
    rsm_intr_hand_arg_t, rsm_addr_t senders_list[],
    uint_t senders_list_length);

/* Registers a handler for a specific interrupt type - driver function */
int wrsm_register_handler(wrsm_network_t *,
    rsm_controller_object_t *controller_obj, rsm_intr_t type, rsm_intr_hand_t,
    rsm_intr_hand_arg_t, rsm_addr_t senders_list[],
    uint_t senders_list_length);

/* Unregisters a handler - rsmpi function */
int wrsmrsm_unregister_handler(rsm_controller_handle_t, rsm_intr_t type,
    rsm_intr_hand_t, rsm_intr_hand_arg_t);

/* Unregisters a handler - driver function */
int wrsm_unregister_handler(wrsm_network_t *, rsm_intr_t type, rsm_intr_hand_t,
    rsm_intr_hand_arg_t);

/*
 * Receive Queue Functions
 */

/*
 * Creates a receive queue of a given type. User must have allocated a
 * CMMU tuple in advance.
 */
int wrsm_intr_create_recvq(wrsm_network_t *, rsm_intr_t type,
    size_t num_packets, wrsm_cmmu_index_t cmmu_index, wrsm_intr_recvq_t **,
    cnodeid_t from_cnode, void *exportseg, int flags);

/* Destroys the receive queue. Caller must free the CMMU tuple. */
void wrsm_intr_destroy_recvq(wrsm_network_t *, wrsm_intr_recvq_t *);

/* Flushes in progress interrupts for the receive queue. */
void wrsm_intr_flush_recvq(wrsm_intr_recvq_t *);

/* Sends a message */
int wrsm_intr_send(wrsm_network_t *, void *remote_addr, cnodeid_t remote_cnode,
    void *aligned_buf, int is_flags, clock_t is_wait, int sendq_flags);

/*
 * RSMPI Functions
 */

/* Initializes RSMPI portions of intr */
void wrsm_intr_rsminit(wrsm_network_t *);

/* Cleans-up RSMPI portions of intr */
void wrsm_intr_rsmfini(wrsm_network_t *);

/* Creates a send queue */
int wrsm_sendq_create(rsm_controller_handle_t, rsm_addr_t, rsm_intr_t,
    rsm_intr_pri_t, size_t qdepth, uint_t flags, rsm_resource_callback_t,
    rsm_resource_callback_arg_t, rsm_send_q_handle_t *);

/* Reconfigure some of the attributes of an interrupt queue */
int wrsm_sendq_config(rsm_send_q_handle_t, rsm_intr_pri_t, size_t qdepth,
    uint_t flags, rsm_resource_callback_t, rsm_resource_callback_arg_t);

/* Destroys an interrupt queue, freeing all resources allocated */
int wrsm_sendq_destroy(rsm_send_q_handle_t);

/* Enqueues a datagram on an interrupt queue */
int wrsm_send(rsm_send_q_handle_t, rsm_send_t *, rsm_barrier_t *);

/*
 * Performs a 64-byte block remote read.
 * Assumes source addressis 64-byte aligned, and does no checking.
 */
void wrsm_blkread(void *src, void *dst, size_t num_blocks);
/*
 * Performs a 64-byte block write.
 * Assumes destination address is 64-byte aligned, and does no checking.
 */
void wrsm_blkwrite(void *src, void *dst, size_t num_blocks);

#endif /* _ASM */

#ifdef __cplusplus
}
#endif

#endif /* _WRSM_INTR_H */