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
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.
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]
23 * Copyright (c) 1999-2000 by Sun Microsystems, Inc.
24 * All rights reserved.
30 #pragma ident "%Z%%M% %I% %E% SMI"
39 * Each RCM module is required to define
41 * struct rcm_mod_ops *rcm_mod_init();
42 * const char *rcm_mod_info();
45 * The rcm_mod_init() is always invoked when the module is loaded. It should
46 * return an rcm_mod_ops vector.
48 * Once the module is loaded, the regis() entry point is
49 * called to allow the module to inform the framework all the
50 * events and devices it cares about.
52 * If at any point of time, the module has no outstanding registration
53 * against any device, the module will be unloaded. The rcm_mod_fini()
54 * entry point, if defined, is always invoked before module unloading.
60 * The ops version must have a valid version number and all function fields
61 * must be non-NULL. Non-conforming RCM modules are rejected.
63 * Valid ops versions are defined below.
66 #define RCM_MOD_OPS_V1 1
67 #define RCM_MOD_OPS_V2 2
68 #define RCM_MOD_OPS_VERSION RCM_MOD_OPS_V2
72 int (*rcmop_register
)(rcm_handle_t
*);
73 int (*rcmop_unregister
)(rcm_handle_t
*);
74 int (*rcmop_get_info
)(rcm_handle_t
*, char *, id_t
, uint_t
,
75 char **, char **, nvlist_t
*, rcm_info_t
**);
76 int (*rcmop_request_suspend
)(rcm_handle_t
*, char *, id_t
,
77 timespec_t
*, uint_t
, char **, rcm_info_t
**);
78 int (*rcmop_notify_resume
)(rcm_handle_t
*, char *, id_t
, uint_t
,
79 char **, rcm_info_t
**);
80 int (*rcmop_request_offline
)(rcm_handle_t
*, char *, id_t
, uint_t
,
81 char **, rcm_info_t
**);
82 int (*rcmop_notify_online
)(rcm_handle_t
*, char *, id_t
, uint_t
,
83 char **, rcm_info_t
**);
84 int (*rcmop_notify_remove
)(rcm_handle_t
*, char *, id_t
, uint_t
,
85 char **, rcm_info_t
**);
87 * Fields for version 2 and beyond
89 int (*rcmop_request_capacity_change
)(rcm_handle_t
*, char *, id_t
,
90 uint_t
, nvlist_t
*, char **, rcm_info_t
**);
91 int (*rcmop_notify_capacity_change
)(rcm_handle_t
*, char *, id_t
,
92 uint_t
, nvlist_t
*, char **, rcm_info_t
**);
93 int (*rcmop_notify_event
)(rcm_handle_t
*, char *, id_t
, uint_t
,
94 char **, nvlist_t
*, rcm_info_t
**);
98 * Version 1 struct for compatibility
100 struct rcm_mod_ops_v1
{
102 int (*rcmop_register
)(rcm_handle_t
*);
103 int (*rcmop_unregister
)(rcm_handle_t
*);
104 int (*rcmop_get_info
)(rcm_handle_t
*, char *, id_t
, uint_t
, char **,
106 int (*rcmop_request_suspend
)(rcm_handle_t
*, char *, id_t
,
107 timespec_t
*, uint_t
, char **, rcm_info_t
**);
108 int (*rcmop_notify_resume
)(rcm_handle_t
*, char *, id_t
, uint_t
,
109 char **, rcm_info_t
**);
110 int (*rcmop_request_offline
)(rcm_handle_t
*, char *, id_t
, uint_t
,
111 char **, rcm_info_t
**);
112 int (*rcmop_notify_online
)(rcm_handle_t
*, char *, id_t
, uint_t
,
113 char **, rcm_info_t
**);
114 int (*rcmop_notify_remove
)(rcm_handle_t
*, char *, id_t
, uint_t
,
115 char **, rcm_info_t
**);
119 * RCM modules should use rcm_log_message() instead of syslog().
120 * This allows the daemon to control the amount of message to be
121 * printed and to redirect output to screen for debugging purposes.
124 /* message levels for rcm_log_message */
126 #define RCM_ERROR 0 /* error message */
127 #define RCM_WARNING 1
130 /* 4 is not used for now */
131 #define RCM_DEBUG 5 /* debug message */
132 #define RCM_TRACE1 6 /* tracing message */
137 extern void rcm_log_message(int, char *, ...);
143 #endif /* _RCM_MODULE_H */