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