1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*7c478bd9Sstevel@tonic-gate * with the License. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 12*7c478bd9Sstevel@tonic-gate * and limitations under the License. 13*7c478bd9Sstevel@tonic-gate * 14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*7c478bd9Sstevel@tonic-gate * 20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END 21*7c478bd9Sstevel@tonic-gate */ 22*7c478bd9Sstevel@tonic-gate /* 23*7c478bd9Sstevel@tonic-gate * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 24*7c478bd9Sstevel@tonic-gate * Use is subject to license terms. 25*7c478bd9Sstevel@tonic-gate */ 26*7c478bd9Sstevel@tonic-gate 27*7c478bd9Sstevel@tonic-gate #ifndef _LIBRCM_H 28*7c478bd9Sstevel@tonic-gate #define _LIBRCM_H 29*7c478bd9Sstevel@tonic-gate 30*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 31*7c478bd9Sstevel@tonic-gate 32*7c478bd9Sstevel@tonic-gate #include <libnvpair.h> 33*7c478bd9Sstevel@tonic-gate #include <sys/types.h> 34*7c478bd9Sstevel@tonic-gate #include <sys/processor.h> 35*7c478bd9Sstevel@tonic-gate #include <sys/pset.h> 36*7c478bd9Sstevel@tonic-gate #include <sys/time_impl.h> 37*7c478bd9Sstevel@tonic-gate 38*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 39*7c478bd9Sstevel@tonic-gate extern "C" { 40*7c478bd9Sstevel@tonic-gate #endif 41*7c478bd9Sstevel@tonic-gate 42*7c478bd9Sstevel@tonic-gate /* 43*7c478bd9Sstevel@tonic-gate * Flags for rcm requests 44*7c478bd9Sstevel@tonic-gate */ 45*7c478bd9Sstevel@tonic-gate #define RCM_INCLUDE_SUBTREE 0x0001 46*7c478bd9Sstevel@tonic-gate #define RCM_INCLUDE_DEPENDENT 0x0002 47*7c478bd9Sstevel@tonic-gate #define RCM_QUERY 0x0004 48*7c478bd9Sstevel@tonic-gate #define RCM_FORCE 0x0008 49*7c478bd9Sstevel@tonic-gate #define RCM_FILESYS 0x0010 /* private to filesys module */ 50*7c478bd9Sstevel@tonic-gate #define RCM_NOPID 0x0020 51*7c478bd9Sstevel@tonic-gate #define RCM_DR_OPERATION 0x0040 52*7c478bd9Sstevel@tonic-gate #define RCM_MOD_INFO 0x0080 /* private */ 53*7c478bd9Sstevel@tonic-gate #define RCM_CAPACITY_ADD 0x0100 54*7c478bd9Sstevel@tonic-gate #define RCM_CAPACITY_DELETE 0x0200 55*7c478bd9Sstevel@tonic-gate #define RCM_QUERY_CANCEL 0x0400 /* private */ 56*7c478bd9Sstevel@tonic-gate #define RCM_SCOPE 0x0800 57*7c478bd9Sstevel@tonic-gate #define RCM_REGISTER_DR 0x1000 /* private */ 58*7c478bd9Sstevel@tonic-gate #define RCM_REGISTER_EVENT 0x2000 /* private */ 59*7c478bd9Sstevel@tonic-gate #define RCM_REGISTER_CAPACITY 0x4000 /* private */ 60*7c478bd9Sstevel@tonic-gate #define RCM_SUSPENDED 0x8000 /* private */ 61*7c478bd9Sstevel@tonic-gate 62*7c478bd9Sstevel@tonic-gate /* 63*7c478bd9Sstevel@tonic-gate * RCM return values 64*7c478bd9Sstevel@tonic-gate */ 65*7c478bd9Sstevel@tonic-gate #define RCM_SUCCESS 0 66*7c478bd9Sstevel@tonic-gate #define RCM_FAILURE -1 67*7c478bd9Sstevel@tonic-gate #define RCM_CONFLICT -2 68*7c478bd9Sstevel@tonic-gate 69*7c478bd9Sstevel@tonic-gate /* 70*7c478bd9Sstevel@tonic-gate * RCM resource states 71*7c478bd9Sstevel@tonic-gate */ 72*7c478bd9Sstevel@tonic-gate #define RCM_STATE_UNKNOWN 0 73*7c478bd9Sstevel@tonic-gate #define RCM_STATE_ONLINE 1 74*7c478bd9Sstevel@tonic-gate #define RCM_STATE_ONLINING 2 75*7c478bd9Sstevel@tonic-gate #define RCM_STATE_OFFLINE_FAIL 3 76*7c478bd9Sstevel@tonic-gate #define RCM_STATE_OFFLINING 4 77*7c478bd9Sstevel@tonic-gate #define RCM_STATE_OFFLINE 5 78*7c478bd9Sstevel@tonic-gate #define RCM_STATE_REMOVING 6 79*7c478bd9Sstevel@tonic-gate #define RCM_STATE_RESUMING 10 80*7c478bd9Sstevel@tonic-gate #define RCM_STATE_SUSPEND_FAIL 11 81*7c478bd9Sstevel@tonic-gate #define RCM_STATE_SUSPENDING 12 82*7c478bd9Sstevel@tonic-gate #define RCM_STATE_SUSPEND 13 83*7c478bd9Sstevel@tonic-gate #define RCM_STATE_REMOVE 14 /* private to rcm_daemon */ 84*7c478bd9Sstevel@tonic-gate #define RCM_STATE_OFFLINE_QUERYING 15 85*7c478bd9Sstevel@tonic-gate #define RCM_STATE_OFFLINE_QUERY_FAIL 16 86*7c478bd9Sstevel@tonic-gate #define RCM_STATE_OFFLINE_QUERY 17 87*7c478bd9Sstevel@tonic-gate #define RCM_STATE_SUSPEND_QUERYING 18 88*7c478bd9Sstevel@tonic-gate #define RCM_STATE_SUSPEND_QUERY_FAIL 19 89*7c478bd9Sstevel@tonic-gate #define RCM_STATE_SUSPEND_QUERY 20 90*7c478bd9Sstevel@tonic-gate 91*7c478bd9Sstevel@tonic-gate /* 92*7c478bd9Sstevel@tonic-gate * RCM event attr and properties 93*7c478bd9Sstevel@tonic-gate */ 94*7c478bd9Sstevel@tonic-gate #define RCM_RSRCNAME "rcm.rsrcname" 95*7c478bd9Sstevel@tonic-gate #define RCM_CLIENT_NAME "rcm.client_name" 96*7c478bd9Sstevel@tonic-gate #define RCM_CLIENT_EXPORTS "rcm.client_exports" 97*7c478bd9Sstevel@tonic-gate 98*7c478bd9Sstevel@tonic-gate /* Resource name to register for new network resources */ 99*7c478bd9Sstevel@tonic-gate #define RCM_RESOURCE_NETWORK_NEW "SUNW_event/resource/new/network" 100*7c478bd9Sstevel@tonic-gate /* Resource name to register for new MAC resources */ 101*7c478bd9Sstevel@tonic-gate #define RCM_RESOURCE_MAC_NEW "SUNW_event/resource/new/mac" 102*7c478bd9Sstevel@tonic-gate 103*7c478bd9Sstevel@tonic-gate /* name-value pair definitions for rcm_notify_event() */ 104*7c478bd9Sstevel@tonic-gate #define RCM_NV_DRIVER_NAME "driver_name" 105*7c478bd9Sstevel@tonic-gate #define RCM_NV_INSTANCE "instance" 106*7c478bd9Sstevel@tonic-gate #define RCM_NV_NODE_NAME "node_name" 107*7c478bd9Sstevel@tonic-gate #define RCM_NV_DEVFS_PATH "devfs_path" 108*7c478bd9Sstevel@tonic-gate #define RCM_NV_MINOR_DATA "minor_data" 109*7c478bd9Sstevel@tonic-gate #define RCM_NV_MINOR_TYPE "minor_type" 110*7c478bd9Sstevel@tonic-gate #define RCM_NV_MINOR_NAME "minor_name" 111*7c478bd9Sstevel@tonic-gate #define RCM_NV_MINOR_NODE_TYPE "minor_node_type" 112*7c478bd9Sstevel@tonic-gate 113*7c478bd9Sstevel@tonic-gate /* 114*7c478bd9Sstevel@tonic-gate * rcm handles 115*7c478bd9Sstevel@tonic-gate */ 116*7c478bd9Sstevel@tonic-gate typedef struct rcm_handle rcm_handle_t; 117*7c478bd9Sstevel@tonic-gate typedef struct rcm_info rcm_info_t; 118*7c478bd9Sstevel@tonic-gate typedef rcm_info_t rcm_info_tuple_t; 119*7c478bd9Sstevel@tonic-gate 120*7c478bd9Sstevel@tonic-gate /* 121*7c478bd9Sstevel@tonic-gate * Interface definitions 122*7c478bd9Sstevel@tonic-gate */ 123*7c478bd9Sstevel@tonic-gate int rcm_alloc_handle(char *, uint_t, void *, rcm_handle_t **); 124*7c478bd9Sstevel@tonic-gate int rcm_free_handle(rcm_handle_t *); 125*7c478bd9Sstevel@tonic-gate int rcm_get_info(rcm_handle_t *, char *, uint_t, rcm_info_t **); 126*7c478bd9Sstevel@tonic-gate int rcm_get_info_list(rcm_handle_t *, char **, uint_t, rcm_info_t **); 127*7c478bd9Sstevel@tonic-gate void rcm_free_info(rcm_info_t *); 128*7c478bd9Sstevel@tonic-gate int rcm_append_info(rcm_info_t **, rcm_info_t *); 129*7c478bd9Sstevel@tonic-gate rcm_info_tuple_t *rcm_info_next(rcm_info_t *, rcm_info_tuple_t *); 130*7c478bd9Sstevel@tonic-gate const char *rcm_info_rsrc(rcm_info_tuple_t *); 131*7c478bd9Sstevel@tonic-gate const char *rcm_info_info(rcm_info_tuple_t *); 132*7c478bd9Sstevel@tonic-gate const char *rcm_info_error(rcm_info_tuple_t *); 133*7c478bd9Sstevel@tonic-gate const char *rcm_info_modname(rcm_info_tuple_t *); 134*7c478bd9Sstevel@tonic-gate pid_t rcm_info_pid(rcm_info_tuple_t *); 135*7c478bd9Sstevel@tonic-gate int rcm_info_state(rcm_info_tuple_t *); 136*7c478bd9Sstevel@tonic-gate int rcm_info_seqnum(rcm_info_tuple_t *); 137*7c478bd9Sstevel@tonic-gate nvlist_t *rcm_info_properties(rcm_info_tuple_t *); 138*7c478bd9Sstevel@tonic-gate 139*7c478bd9Sstevel@tonic-gate int rcm_request_offline(rcm_handle_t *, char *, uint_t, rcm_info_t **); 140*7c478bd9Sstevel@tonic-gate int rcm_request_offline_list(rcm_handle_t *, char **, uint_t, rcm_info_t **); 141*7c478bd9Sstevel@tonic-gate int rcm_notify_online(rcm_handle_t *, char *, uint_t, rcm_info_t **); 142*7c478bd9Sstevel@tonic-gate int rcm_notify_online_list(rcm_handle_t *, char **, uint_t, rcm_info_t **); 143*7c478bd9Sstevel@tonic-gate int rcm_notify_remove(rcm_handle_t *, char *, uint_t, rcm_info_t **); 144*7c478bd9Sstevel@tonic-gate int rcm_notify_remove_list(rcm_handle_t *, char **, uint_t, rcm_info_t **); 145*7c478bd9Sstevel@tonic-gate int rcm_request_suspend(rcm_handle_t *, char *, uint_t, timespec_t *, 146*7c478bd9Sstevel@tonic-gate rcm_info_t **); 147*7c478bd9Sstevel@tonic-gate int rcm_request_suspend_list(rcm_handle_t *, char **, uint_t, timespec_t *, 148*7c478bd9Sstevel@tonic-gate rcm_info_t **); 149*7c478bd9Sstevel@tonic-gate int rcm_notify_resume(rcm_handle_t *, char *, uint_t, rcm_info_t **); 150*7c478bd9Sstevel@tonic-gate int rcm_notify_resume_list(rcm_handle_t *, char **, uint_t, rcm_info_t **); 151*7c478bd9Sstevel@tonic-gate int rcm_notify_capacity_change(rcm_handle_t *, char *, uint_t, nvlist_t *, 152*7c478bd9Sstevel@tonic-gate rcm_info_t **); 153*7c478bd9Sstevel@tonic-gate int rcm_request_capacity_change(rcm_handle_t *, char *, uint_t, nvlist_t *, 154*7c478bd9Sstevel@tonic-gate rcm_info_t **); 155*7c478bd9Sstevel@tonic-gate int rcm_notify_event(rcm_handle_t *, char *, uint_t, nvlist_t *, rcm_info_t **); 156*7c478bd9Sstevel@tonic-gate 157*7c478bd9Sstevel@tonic-gate int rcm_register_event(rcm_handle_t *, char *, uint_t, rcm_info_t **); 158*7c478bd9Sstevel@tonic-gate int rcm_register_capacity(rcm_handle_t *, char *, uint_t, rcm_info_t **); 159*7c478bd9Sstevel@tonic-gate int rcm_register_interest(rcm_handle_t *, char *, uint_t, rcm_info_t **); 160*7c478bd9Sstevel@tonic-gate int rcm_unregister_event(rcm_handle_t *, char *, uint_t); 161*7c478bd9Sstevel@tonic-gate int rcm_unregister_capacity(rcm_handle_t *, char *, uint_t); 162*7c478bd9Sstevel@tonic-gate int rcm_unregister_interest(rcm_handle_t *, char *, uint_t); 163*7c478bd9Sstevel@tonic-gate 164*7c478bd9Sstevel@tonic-gate int rcm_get_rsrcstate(rcm_handle_t *, char *, int *); 165*7c478bd9Sstevel@tonic-gate int rcm_exec_cmd(char *); 166*7c478bd9Sstevel@tonic-gate const char *rcm_get_client_name(rcm_handle_t *); 167*7c478bd9Sstevel@tonic-gate 168*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 169*7c478bd9Sstevel@tonic-gate } 170*7c478bd9Sstevel@tonic-gate #endif 171*7c478bd9Sstevel@tonic-gate 172*7c478bd9Sstevel@tonic-gate #endif /* _LIBRCM_H */ 173