10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 51804Sericheng * Common Development and Distribution License (the "License"). 61804Sericheng * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 210Sstevel@tonic-gate /* 22*8698SCathy.Zhou@Sun.COM * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 230Sstevel@tonic-gate * Use is subject to license terms. 240Sstevel@tonic-gate */ 250Sstevel@tonic-gate 260Sstevel@tonic-gate #ifndef _LIBRCM_H 270Sstevel@tonic-gate #define _LIBRCM_H 280Sstevel@tonic-gate 290Sstevel@tonic-gate #include <libnvpair.h> 300Sstevel@tonic-gate #include <sys/types.h> 310Sstevel@tonic-gate #include <sys/processor.h> 320Sstevel@tonic-gate #include <sys/pset.h> 330Sstevel@tonic-gate #include <sys/time_impl.h> 340Sstevel@tonic-gate 350Sstevel@tonic-gate #ifdef __cplusplus 360Sstevel@tonic-gate extern "C" { 370Sstevel@tonic-gate #endif 380Sstevel@tonic-gate 390Sstevel@tonic-gate /* 400Sstevel@tonic-gate * Flags for rcm requests 410Sstevel@tonic-gate */ 420Sstevel@tonic-gate #define RCM_INCLUDE_SUBTREE 0x0001 430Sstevel@tonic-gate #define RCM_INCLUDE_DEPENDENT 0x0002 440Sstevel@tonic-gate #define RCM_QUERY 0x0004 450Sstevel@tonic-gate #define RCM_FORCE 0x0008 460Sstevel@tonic-gate #define RCM_FILESYS 0x0010 /* private to filesys module */ 470Sstevel@tonic-gate #define RCM_NOPID 0x0020 480Sstevel@tonic-gate #define RCM_DR_OPERATION 0x0040 490Sstevel@tonic-gate #define RCM_MOD_INFO 0x0080 /* private */ 500Sstevel@tonic-gate #define RCM_CAPACITY_ADD 0x0100 510Sstevel@tonic-gate #define RCM_CAPACITY_DELETE 0x0200 520Sstevel@tonic-gate #define RCM_QUERY_CANCEL 0x0400 /* private */ 530Sstevel@tonic-gate #define RCM_SCOPE 0x0800 540Sstevel@tonic-gate #define RCM_REGISTER_DR 0x1000 /* private */ 550Sstevel@tonic-gate #define RCM_REGISTER_EVENT 0x2000 /* private */ 560Sstevel@tonic-gate #define RCM_REGISTER_CAPACITY 0x4000 /* private */ 570Sstevel@tonic-gate #define RCM_SUSPENDED 0x8000 /* private */ 584845Svikram #define RCM_RETIRE_REQUEST 0x10000 594845Svikram #define RCM_RETIRE_NOTIFY 0x20000 600Sstevel@tonic-gate 610Sstevel@tonic-gate /* 620Sstevel@tonic-gate * RCM return values 630Sstevel@tonic-gate */ 640Sstevel@tonic-gate #define RCM_SUCCESS 0 650Sstevel@tonic-gate #define RCM_FAILURE -1 660Sstevel@tonic-gate #define RCM_CONFLICT -2 674845Svikram #define RCM_NO_CONSTRAINT -3 680Sstevel@tonic-gate 690Sstevel@tonic-gate /* 700Sstevel@tonic-gate * RCM resource states 710Sstevel@tonic-gate */ 720Sstevel@tonic-gate #define RCM_STATE_UNKNOWN 0 730Sstevel@tonic-gate #define RCM_STATE_ONLINE 1 740Sstevel@tonic-gate #define RCM_STATE_ONLINING 2 750Sstevel@tonic-gate #define RCM_STATE_OFFLINE_FAIL 3 760Sstevel@tonic-gate #define RCM_STATE_OFFLINING 4 770Sstevel@tonic-gate #define RCM_STATE_OFFLINE 5 780Sstevel@tonic-gate #define RCM_STATE_REMOVING 6 790Sstevel@tonic-gate #define RCM_STATE_RESUMING 10 800Sstevel@tonic-gate #define RCM_STATE_SUSPEND_FAIL 11 810Sstevel@tonic-gate #define RCM_STATE_SUSPENDING 12 820Sstevel@tonic-gate #define RCM_STATE_SUSPEND 13 830Sstevel@tonic-gate #define RCM_STATE_REMOVE 14 /* private to rcm_daemon */ 840Sstevel@tonic-gate #define RCM_STATE_OFFLINE_QUERYING 15 850Sstevel@tonic-gate #define RCM_STATE_OFFLINE_QUERY_FAIL 16 860Sstevel@tonic-gate #define RCM_STATE_OFFLINE_QUERY 17 870Sstevel@tonic-gate #define RCM_STATE_SUSPEND_QUERYING 18 880Sstevel@tonic-gate #define RCM_STATE_SUSPEND_QUERY_FAIL 19 890Sstevel@tonic-gate #define RCM_STATE_SUSPEND_QUERY 20 900Sstevel@tonic-gate 910Sstevel@tonic-gate /* 920Sstevel@tonic-gate * RCM event attr and properties 930Sstevel@tonic-gate */ 940Sstevel@tonic-gate #define RCM_RSRCNAME "rcm.rsrcname" 950Sstevel@tonic-gate #define RCM_CLIENT_NAME "rcm.client_name" 960Sstevel@tonic-gate #define RCM_CLIENT_EXPORTS "rcm.client_exports" 970Sstevel@tonic-gate 98*8698SCathy.Zhou@Sun.COM /* Resource name to register for new links reconfigured */ 995895Syz147064 #define RCM_RESOURCE_LINK_NEW "SUNW_event/resource/new/link" 1000Sstevel@tonic-gate 101*8698SCathy.Zhou@Sun.COM /* Resource name to register for new physical data-links */ 102*8698SCathy.Zhou@Sun.COM #define RCM_RESOURCE_PHYSLINK_NEW "SUNW_event/resource/new/physlink" 103*8698SCathy.Zhou@Sun.COM 1040Sstevel@tonic-gate /* name-value pair definitions for rcm_notify_event() */ 1055895Syz147064 #define RCM_NV_LINKID "linkid" 106*8698SCathy.Zhou@Sun.COM #define RCM_NV_RECONFIGURED "reconfigured" 1070Sstevel@tonic-gate 1080Sstevel@tonic-gate /* 1090Sstevel@tonic-gate * rcm handles 1100Sstevel@tonic-gate */ 1110Sstevel@tonic-gate typedef struct rcm_handle rcm_handle_t; 1120Sstevel@tonic-gate typedef struct rcm_info rcm_info_t; 1130Sstevel@tonic-gate typedef rcm_info_t rcm_info_tuple_t; 1140Sstevel@tonic-gate 1150Sstevel@tonic-gate /* 1160Sstevel@tonic-gate * Interface definitions 1170Sstevel@tonic-gate */ 1180Sstevel@tonic-gate int rcm_alloc_handle(char *, uint_t, void *, rcm_handle_t **); 1190Sstevel@tonic-gate int rcm_free_handle(rcm_handle_t *); 1200Sstevel@tonic-gate int rcm_get_info(rcm_handle_t *, char *, uint_t, rcm_info_t **); 1210Sstevel@tonic-gate int rcm_get_info_list(rcm_handle_t *, char **, uint_t, rcm_info_t **); 1220Sstevel@tonic-gate void rcm_free_info(rcm_info_t *); 1230Sstevel@tonic-gate int rcm_append_info(rcm_info_t **, rcm_info_t *); 1240Sstevel@tonic-gate rcm_info_tuple_t *rcm_info_next(rcm_info_t *, rcm_info_tuple_t *); 1250Sstevel@tonic-gate const char *rcm_info_rsrc(rcm_info_tuple_t *); 1260Sstevel@tonic-gate const char *rcm_info_info(rcm_info_tuple_t *); 1270Sstevel@tonic-gate const char *rcm_info_error(rcm_info_tuple_t *); 1280Sstevel@tonic-gate const char *rcm_info_modname(rcm_info_tuple_t *); 1290Sstevel@tonic-gate pid_t rcm_info_pid(rcm_info_tuple_t *); 1300Sstevel@tonic-gate int rcm_info_state(rcm_info_tuple_t *); 1310Sstevel@tonic-gate int rcm_info_seqnum(rcm_info_tuple_t *); 1320Sstevel@tonic-gate nvlist_t *rcm_info_properties(rcm_info_tuple_t *); 1330Sstevel@tonic-gate 1340Sstevel@tonic-gate int rcm_request_offline(rcm_handle_t *, char *, uint_t, rcm_info_t **); 1350Sstevel@tonic-gate int rcm_request_offline_list(rcm_handle_t *, char **, uint_t, rcm_info_t **); 1360Sstevel@tonic-gate int rcm_notify_online(rcm_handle_t *, char *, uint_t, rcm_info_t **); 1370Sstevel@tonic-gate int rcm_notify_online_list(rcm_handle_t *, char **, uint_t, rcm_info_t **); 1380Sstevel@tonic-gate int rcm_notify_remove(rcm_handle_t *, char *, uint_t, rcm_info_t **); 1390Sstevel@tonic-gate int rcm_notify_remove_list(rcm_handle_t *, char **, uint_t, rcm_info_t **); 1400Sstevel@tonic-gate int rcm_request_suspend(rcm_handle_t *, char *, uint_t, timespec_t *, 1410Sstevel@tonic-gate rcm_info_t **); 1420Sstevel@tonic-gate int rcm_request_suspend_list(rcm_handle_t *, char **, uint_t, timespec_t *, 1430Sstevel@tonic-gate rcm_info_t **); 1440Sstevel@tonic-gate int rcm_notify_resume(rcm_handle_t *, char *, uint_t, rcm_info_t **); 1450Sstevel@tonic-gate int rcm_notify_resume_list(rcm_handle_t *, char **, uint_t, rcm_info_t **); 1460Sstevel@tonic-gate int rcm_notify_capacity_change(rcm_handle_t *, char *, uint_t, nvlist_t *, 1470Sstevel@tonic-gate rcm_info_t **); 1480Sstevel@tonic-gate int rcm_request_capacity_change(rcm_handle_t *, char *, uint_t, nvlist_t *, 1490Sstevel@tonic-gate rcm_info_t **); 1500Sstevel@tonic-gate int rcm_notify_event(rcm_handle_t *, char *, uint_t, nvlist_t *, rcm_info_t **); 1510Sstevel@tonic-gate 1520Sstevel@tonic-gate int rcm_register_event(rcm_handle_t *, char *, uint_t, rcm_info_t **); 1530Sstevel@tonic-gate int rcm_register_capacity(rcm_handle_t *, char *, uint_t, rcm_info_t **); 1540Sstevel@tonic-gate int rcm_register_interest(rcm_handle_t *, char *, uint_t, rcm_info_t **); 1550Sstevel@tonic-gate int rcm_unregister_event(rcm_handle_t *, char *, uint_t); 1560Sstevel@tonic-gate int rcm_unregister_capacity(rcm_handle_t *, char *, uint_t); 1570Sstevel@tonic-gate int rcm_unregister_interest(rcm_handle_t *, char *, uint_t); 1580Sstevel@tonic-gate 1590Sstevel@tonic-gate int rcm_get_rsrcstate(rcm_handle_t *, char *, int *); 1600Sstevel@tonic-gate int rcm_exec_cmd(char *); 1610Sstevel@tonic-gate const char *rcm_get_client_name(rcm_handle_t *); 1620Sstevel@tonic-gate 1630Sstevel@tonic-gate #ifdef __cplusplus 1640Sstevel@tonic-gate } 1650Sstevel@tonic-gate #endif 1660Sstevel@tonic-gate 1670Sstevel@tonic-gate #endif /* _LIBRCM_H */ 168