17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5c0192a57Sericheng * Common Development and Distribution License (the "License"). 6c0192a57Sericheng * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 217c478bd9Sstevel@tonic-gate /* 22*25e8c5aaSvikram * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 237c478bd9Sstevel@tonic-gate * Use is subject to license terms. 247c478bd9Sstevel@tonic-gate */ 257c478bd9Sstevel@tonic-gate 267c478bd9Sstevel@tonic-gate #ifndef _LIBRCM_H 277c478bd9Sstevel@tonic-gate #define _LIBRCM_H 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 307c478bd9Sstevel@tonic-gate 317c478bd9Sstevel@tonic-gate #include <libnvpair.h> 327c478bd9Sstevel@tonic-gate #include <sys/types.h> 337c478bd9Sstevel@tonic-gate #include <sys/processor.h> 347c478bd9Sstevel@tonic-gate #include <sys/pset.h> 357c478bd9Sstevel@tonic-gate #include <sys/time_impl.h> 367c478bd9Sstevel@tonic-gate 377c478bd9Sstevel@tonic-gate #ifdef __cplusplus 387c478bd9Sstevel@tonic-gate extern "C" { 397c478bd9Sstevel@tonic-gate #endif 407c478bd9Sstevel@tonic-gate 417c478bd9Sstevel@tonic-gate /* 427c478bd9Sstevel@tonic-gate * Flags for rcm requests 437c478bd9Sstevel@tonic-gate */ 447c478bd9Sstevel@tonic-gate #define RCM_INCLUDE_SUBTREE 0x0001 457c478bd9Sstevel@tonic-gate #define RCM_INCLUDE_DEPENDENT 0x0002 467c478bd9Sstevel@tonic-gate #define RCM_QUERY 0x0004 477c478bd9Sstevel@tonic-gate #define RCM_FORCE 0x0008 487c478bd9Sstevel@tonic-gate #define RCM_FILESYS 0x0010 /* private to filesys module */ 497c478bd9Sstevel@tonic-gate #define RCM_NOPID 0x0020 507c478bd9Sstevel@tonic-gate #define RCM_DR_OPERATION 0x0040 517c478bd9Sstevel@tonic-gate #define RCM_MOD_INFO 0x0080 /* private */ 527c478bd9Sstevel@tonic-gate #define RCM_CAPACITY_ADD 0x0100 537c478bd9Sstevel@tonic-gate #define RCM_CAPACITY_DELETE 0x0200 547c478bd9Sstevel@tonic-gate #define RCM_QUERY_CANCEL 0x0400 /* private */ 557c478bd9Sstevel@tonic-gate #define RCM_SCOPE 0x0800 567c478bd9Sstevel@tonic-gate #define RCM_REGISTER_DR 0x1000 /* private */ 577c478bd9Sstevel@tonic-gate #define RCM_REGISTER_EVENT 0x2000 /* private */ 587c478bd9Sstevel@tonic-gate #define RCM_REGISTER_CAPACITY 0x4000 /* private */ 597c478bd9Sstevel@tonic-gate #define RCM_SUSPENDED 0x8000 /* private */ 60*25e8c5aaSvikram #define RCM_RETIRE_REQUEST 0x10000 61*25e8c5aaSvikram #define RCM_RETIRE_NOTIFY 0x20000 627c478bd9Sstevel@tonic-gate 637c478bd9Sstevel@tonic-gate /* 647c478bd9Sstevel@tonic-gate * RCM return values 657c478bd9Sstevel@tonic-gate */ 667c478bd9Sstevel@tonic-gate #define RCM_SUCCESS 0 677c478bd9Sstevel@tonic-gate #define RCM_FAILURE -1 687c478bd9Sstevel@tonic-gate #define RCM_CONFLICT -2 69*25e8c5aaSvikram #define RCM_NO_CONSTRAINT -3 707c478bd9Sstevel@tonic-gate 717c478bd9Sstevel@tonic-gate /* 727c478bd9Sstevel@tonic-gate * RCM resource states 737c478bd9Sstevel@tonic-gate */ 747c478bd9Sstevel@tonic-gate #define RCM_STATE_UNKNOWN 0 757c478bd9Sstevel@tonic-gate #define RCM_STATE_ONLINE 1 767c478bd9Sstevel@tonic-gate #define RCM_STATE_ONLINING 2 777c478bd9Sstevel@tonic-gate #define RCM_STATE_OFFLINE_FAIL 3 787c478bd9Sstevel@tonic-gate #define RCM_STATE_OFFLINING 4 797c478bd9Sstevel@tonic-gate #define RCM_STATE_OFFLINE 5 807c478bd9Sstevel@tonic-gate #define RCM_STATE_REMOVING 6 817c478bd9Sstevel@tonic-gate #define RCM_STATE_RESUMING 10 827c478bd9Sstevel@tonic-gate #define RCM_STATE_SUSPEND_FAIL 11 837c478bd9Sstevel@tonic-gate #define RCM_STATE_SUSPENDING 12 847c478bd9Sstevel@tonic-gate #define RCM_STATE_SUSPEND 13 857c478bd9Sstevel@tonic-gate #define RCM_STATE_REMOVE 14 /* private to rcm_daemon */ 867c478bd9Sstevel@tonic-gate #define RCM_STATE_OFFLINE_QUERYING 15 877c478bd9Sstevel@tonic-gate #define RCM_STATE_OFFLINE_QUERY_FAIL 16 887c478bd9Sstevel@tonic-gate #define RCM_STATE_OFFLINE_QUERY 17 897c478bd9Sstevel@tonic-gate #define RCM_STATE_SUSPEND_QUERYING 18 907c478bd9Sstevel@tonic-gate #define RCM_STATE_SUSPEND_QUERY_FAIL 19 917c478bd9Sstevel@tonic-gate #define RCM_STATE_SUSPEND_QUERY 20 927c478bd9Sstevel@tonic-gate 937c478bd9Sstevel@tonic-gate /* 947c478bd9Sstevel@tonic-gate * RCM event attr and properties 957c478bd9Sstevel@tonic-gate */ 967c478bd9Sstevel@tonic-gate #define RCM_RSRCNAME "rcm.rsrcname" 977c478bd9Sstevel@tonic-gate #define RCM_CLIENT_NAME "rcm.client_name" 987c478bd9Sstevel@tonic-gate #define RCM_CLIENT_EXPORTS "rcm.client_exports" 997c478bd9Sstevel@tonic-gate 1007c478bd9Sstevel@tonic-gate /* Resource name to register for new network resources */ 1017c478bd9Sstevel@tonic-gate #define RCM_RESOURCE_NETWORK_NEW "SUNW_event/resource/new/network" 1027c478bd9Sstevel@tonic-gate 1037c478bd9Sstevel@tonic-gate /* name-value pair definitions for rcm_notify_event() */ 1047c478bd9Sstevel@tonic-gate #define RCM_NV_DRIVER_NAME "driver_name" 1057c478bd9Sstevel@tonic-gate #define RCM_NV_INSTANCE "instance" 1067c478bd9Sstevel@tonic-gate #define RCM_NV_NODE_NAME "node_name" 1077c478bd9Sstevel@tonic-gate #define RCM_NV_DEVFS_PATH "devfs_path" 1087c478bd9Sstevel@tonic-gate #define RCM_NV_MINOR_DATA "minor_data" 1097c478bd9Sstevel@tonic-gate #define RCM_NV_MINOR_TYPE "minor_type" 1107c478bd9Sstevel@tonic-gate #define RCM_NV_MINOR_NAME "minor_name" 1117c478bd9Sstevel@tonic-gate #define RCM_NV_MINOR_NODE_TYPE "minor_node_type" 1127c478bd9Sstevel@tonic-gate 1137c478bd9Sstevel@tonic-gate /* 1147c478bd9Sstevel@tonic-gate * rcm handles 1157c478bd9Sstevel@tonic-gate */ 1167c478bd9Sstevel@tonic-gate typedef struct rcm_handle rcm_handle_t; 1177c478bd9Sstevel@tonic-gate typedef struct rcm_info rcm_info_t; 1187c478bd9Sstevel@tonic-gate typedef rcm_info_t rcm_info_tuple_t; 1197c478bd9Sstevel@tonic-gate 1207c478bd9Sstevel@tonic-gate /* 1217c478bd9Sstevel@tonic-gate * Interface definitions 1227c478bd9Sstevel@tonic-gate */ 1237c478bd9Sstevel@tonic-gate int rcm_alloc_handle(char *, uint_t, void *, rcm_handle_t **); 1247c478bd9Sstevel@tonic-gate int rcm_free_handle(rcm_handle_t *); 1257c478bd9Sstevel@tonic-gate int rcm_get_info(rcm_handle_t *, char *, uint_t, rcm_info_t **); 1267c478bd9Sstevel@tonic-gate int rcm_get_info_list(rcm_handle_t *, char **, uint_t, rcm_info_t **); 1277c478bd9Sstevel@tonic-gate void rcm_free_info(rcm_info_t *); 1287c478bd9Sstevel@tonic-gate int rcm_append_info(rcm_info_t **, rcm_info_t *); 1297c478bd9Sstevel@tonic-gate rcm_info_tuple_t *rcm_info_next(rcm_info_t *, rcm_info_tuple_t *); 1307c478bd9Sstevel@tonic-gate const char *rcm_info_rsrc(rcm_info_tuple_t *); 1317c478bd9Sstevel@tonic-gate const char *rcm_info_info(rcm_info_tuple_t *); 1327c478bd9Sstevel@tonic-gate const char *rcm_info_error(rcm_info_tuple_t *); 1337c478bd9Sstevel@tonic-gate const char *rcm_info_modname(rcm_info_tuple_t *); 1347c478bd9Sstevel@tonic-gate pid_t rcm_info_pid(rcm_info_tuple_t *); 1357c478bd9Sstevel@tonic-gate int rcm_info_state(rcm_info_tuple_t *); 1367c478bd9Sstevel@tonic-gate int rcm_info_seqnum(rcm_info_tuple_t *); 1377c478bd9Sstevel@tonic-gate nvlist_t *rcm_info_properties(rcm_info_tuple_t *); 1387c478bd9Sstevel@tonic-gate 1397c478bd9Sstevel@tonic-gate int rcm_request_offline(rcm_handle_t *, char *, uint_t, rcm_info_t **); 1407c478bd9Sstevel@tonic-gate int rcm_request_offline_list(rcm_handle_t *, char **, uint_t, rcm_info_t **); 1417c478bd9Sstevel@tonic-gate int rcm_notify_online(rcm_handle_t *, char *, uint_t, rcm_info_t **); 1427c478bd9Sstevel@tonic-gate int rcm_notify_online_list(rcm_handle_t *, char **, uint_t, rcm_info_t **); 1437c478bd9Sstevel@tonic-gate int rcm_notify_remove(rcm_handle_t *, char *, uint_t, rcm_info_t **); 1447c478bd9Sstevel@tonic-gate int rcm_notify_remove_list(rcm_handle_t *, char **, uint_t, rcm_info_t **); 1457c478bd9Sstevel@tonic-gate int rcm_request_suspend(rcm_handle_t *, char *, uint_t, timespec_t *, 1467c478bd9Sstevel@tonic-gate rcm_info_t **); 1477c478bd9Sstevel@tonic-gate int rcm_request_suspend_list(rcm_handle_t *, char **, uint_t, timespec_t *, 1487c478bd9Sstevel@tonic-gate rcm_info_t **); 1497c478bd9Sstevel@tonic-gate int rcm_notify_resume(rcm_handle_t *, char *, uint_t, rcm_info_t **); 1507c478bd9Sstevel@tonic-gate int rcm_notify_resume_list(rcm_handle_t *, char **, uint_t, rcm_info_t **); 1517c478bd9Sstevel@tonic-gate int rcm_notify_capacity_change(rcm_handle_t *, char *, uint_t, nvlist_t *, 1527c478bd9Sstevel@tonic-gate rcm_info_t **); 1537c478bd9Sstevel@tonic-gate int rcm_request_capacity_change(rcm_handle_t *, char *, uint_t, nvlist_t *, 1547c478bd9Sstevel@tonic-gate rcm_info_t **); 1557c478bd9Sstevel@tonic-gate int rcm_notify_event(rcm_handle_t *, char *, uint_t, nvlist_t *, rcm_info_t **); 1567c478bd9Sstevel@tonic-gate 1577c478bd9Sstevel@tonic-gate int rcm_register_event(rcm_handle_t *, char *, uint_t, rcm_info_t **); 1587c478bd9Sstevel@tonic-gate int rcm_register_capacity(rcm_handle_t *, char *, uint_t, rcm_info_t **); 1597c478bd9Sstevel@tonic-gate int rcm_register_interest(rcm_handle_t *, char *, uint_t, rcm_info_t **); 1607c478bd9Sstevel@tonic-gate int rcm_unregister_event(rcm_handle_t *, char *, uint_t); 1617c478bd9Sstevel@tonic-gate int rcm_unregister_capacity(rcm_handle_t *, char *, uint_t); 1627c478bd9Sstevel@tonic-gate int rcm_unregister_interest(rcm_handle_t *, char *, uint_t); 1637c478bd9Sstevel@tonic-gate 1647c478bd9Sstevel@tonic-gate int rcm_get_rsrcstate(rcm_handle_t *, char *, int *); 1657c478bd9Sstevel@tonic-gate int rcm_exec_cmd(char *); 1667c478bd9Sstevel@tonic-gate const char *rcm_get_client_name(rcm_handle_t *); 1677c478bd9Sstevel@tonic-gate 1687c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1697c478bd9Sstevel@tonic-gate } 1707c478bd9Sstevel@tonic-gate #endif 1717c478bd9Sstevel@tonic-gate 1727c478bd9Sstevel@tonic-gate #endif /* _LIBRCM_H */ 173