xref: /titanic_50/usr/src/uts/common/sys/rsm/rsmpi_driver.h (revision 5d0e1406420f52cc4d3d0543044034c4894b5865)
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 (c) 2000-2001 by Sun Microsystems, Inc.
24  * All rights reserved.
25  */
26 
27 #ifndef _SYS_RSM_RSMPI_DRIVER_H
28 #define	_SYS_RSM_RSMPI_DRIVER_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 #include <sys/rsm/rsmpi.h>
37 
38 /*
39  * The following is information which each RSMPI driver must
40  * provide when registering with the RSMOPS module
41  */
42 #define	MAX_DRVNAME	15
43 
44 typedef struct rsmops_registry {
45 	unsigned int rsm_version;	/* version of the RSMPI driver */
46 	char drv_name[MAX_DRVNAME+1];	/* name of the RSMPI driver */
47 	int (*rsm_get_controller_handler)(const char *name,
48 		uint_t number,
49 		rsm_controller_object_t *pcontroller,
50 		uint_t version);
51 	int (*rsm_release_controller_handler)(const char *name,
52 		uint_t number,
53 		rsm_controller_object_t *pcontroller);
54 	void (*rsm_thread_entry_pt)(const char *name /* name of driver */);
55 } rsmops_registry_t;
56 
57 typedef struct rsmops_ctrl_registry {
58 	uint_t	number;
59 	int refcnt;		/* number of outstanding handles */
60 	rsm_controller_attr_t *attrp;
61 	rsm_controller_handle_t handle;
62 	struct rsmops_ctrl_registry *next;
63 	struct rsmops_drv_registry *p_drv;	/* back ptr to drvr struct */
64 } rsmops_ctrl_t;
65 
66 typedef struct rsmops_drv_registry {
67 	rsmops_registry_t drv;
68 	int ctrl_cnt;	/* Number of controllers which have registered */
69 	struct rsmops_drv_registry *next;
70 	rsmops_ctrl_t *ctrl_head;
71 	kthread_id_t thread_id;
72 } rsmops_drv_t;
73 
74 int rsm_register_controller(const char *name,
75 	uint_t number, rsm_controller_attr_t *attrp);
76 
77 int rsm_unregister_controller(const char *name, uint_t number);
78 
79 int rsm_register_driver(rsmops_registry_t *p_registry);
80 int rsm_unregister_driver(rsmops_registry_t *p_registry);
81 
82 #ifdef	__cplusplus
83 }
84 #endif
85 
86 #endif	/* _SYS_RSM_RSMPI_DRIVER_H */
87