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 2004 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 _SYS_POOL_IMPL_H 28*7c478bd9Sstevel@tonic-gate #define _SYS_POOL_IMPL_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 <sys/types.h> 33*7c478bd9Sstevel@tonic-gate #include <sys/cpupart.h> 34*7c478bd9Sstevel@tonic-gate #include <sys/exacct_catalog.h> 35*7c478bd9Sstevel@tonic-gate #include <sys/nvpair.h> 36*7c478bd9Sstevel@tonic-gate 37*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 38*7c478bd9Sstevel@tonic-gate extern "C" { 39*7c478bd9Sstevel@tonic-gate #endif 40*7c478bd9Sstevel@tonic-gate 41*7c478bd9Sstevel@tonic-gate /* 42*7c478bd9Sstevel@tonic-gate * Pools driver ioctl interfaces 43*7c478bd9Sstevel@tonic-gate */ 44*7c478bd9Sstevel@tonic-gate #define POOL_STATUS 0 45*7c478bd9Sstevel@tonic-gate #define POOL_STATUSQ 1 46*7c478bd9Sstevel@tonic-gate #define POOL_CREATE 2 47*7c478bd9Sstevel@tonic-gate #define POOL_DESTROY 3 48*7c478bd9Sstevel@tonic-gate #define POOL_QUERY 4 49*7c478bd9Sstevel@tonic-gate #define POOL_ASSOC 5 50*7c478bd9Sstevel@tonic-gate #define POOL_DISSOC 6 51*7c478bd9Sstevel@tonic-gate #define POOL_TRANSFER 7 52*7c478bd9Sstevel@tonic-gate #define POOL_XTRANSFER 8 53*7c478bd9Sstevel@tonic-gate #define POOL_PROPGET 9 54*7c478bd9Sstevel@tonic-gate #define POOL_PROPPUT 10 55*7c478bd9Sstevel@tonic-gate #define POOL_PROPRM 11 56*7c478bd9Sstevel@tonic-gate #define POOL_BIND 12 57*7c478bd9Sstevel@tonic-gate #define POOL_BINDQ 13 58*7c478bd9Sstevel@tonic-gate #define POOL_COMMIT 14 59*7c478bd9Sstevel@tonic-gate 60*7c478bd9Sstevel@tonic-gate /* 61*7c478bd9Sstevel@tonic-gate * Pools-related exacct catalog IDs 62*7c478bd9Sstevel@tonic-gate */ 63*7c478bd9Sstevel@tonic-gate #define EXD_GROUP_SYSTEM 0x000000 64*7c478bd9Sstevel@tonic-gate #define EXD_SYSTEM_PROP 0x000001 65*7c478bd9Sstevel@tonic-gate #define EXD_SYSTEM_TSTAMP 0x000002 66*7c478bd9Sstevel@tonic-gate 67*7c478bd9Sstevel@tonic-gate #define EXD_GROUP_POOL 0x000100 68*7c478bd9Sstevel@tonic-gate #define EXD_POOL_POOLID 0x000101 69*7c478bd9Sstevel@tonic-gate #define EXD_POOL_PSETID 0x000102 70*7c478bd9Sstevel@tonic-gate #define EXD_POOL_PROP 0x000104 71*7c478bd9Sstevel@tonic-gate #define EXD_POOL_TSTAMP 0x000105 72*7c478bd9Sstevel@tonic-gate 73*7c478bd9Sstevel@tonic-gate #define EXD_GROUP_PSET 0x000200 74*7c478bd9Sstevel@tonic-gate #define EXD_PSET_PSETID 0x000201 75*7c478bd9Sstevel@tonic-gate #define EXD_PSET_PROP 0x000202 76*7c478bd9Sstevel@tonic-gate #define EXD_PSET_TSTAMP 0x000203 77*7c478bd9Sstevel@tonic-gate 78*7c478bd9Sstevel@tonic-gate #define EXD_GROUP_CPU 0x000400 79*7c478bd9Sstevel@tonic-gate #define EXD_CPU_CPUID 0x000401 80*7c478bd9Sstevel@tonic-gate #define EXD_CPU_PROP 0x000402 81*7c478bd9Sstevel@tonic-gate #define EXD_CPU_TSTAMP 0x000403 82*7c478bd9Sstevel@tonic-gate 83*7c478bd9Sstevel@tonic-gate /* 84*7c478bd9Sstevel@tonic-gate * Element Types 85*7c478bd9Sstevel@tonic-gate */ 86*7c478bd9Sstevel@tonic-gate typedef enum pool_elem_class { 87*7c478bd9Sstevel@tonic-gate PEC_INVALID = 0, /* invalid class, for error reporting */ 88*7c478bd9Sstevel@tonic-gate PEC_SYSTEM, /* a system */ 89*7c478bd9Sstevel@tonic-gate PEC_POOL, /* a pool */ 90*7c478bd9Sstevel@tonic-gate PEC_RES_COMP, /* a set */ 91*7c478bd9Sstevel@tonic-gate PEC_RES_AGG, /* a set */ 92*7c478bd9Sstevel@tonic-gate PEC_COMP /* a resource component */ 93*7c478bd9Sstevel@tonic-gate } pool_elem_class_t; 94*7c478bd9Sstevel@tonic-gate 95*7c478bd9Sstevel@tonic-gate typedef enum pool_resource_elem_class { 96*7c478bd9Sstevel@tonic-gate PREC_INVALID = 0, 97*7c478bd9Sstevel@tonic-gate PREC_PSET /* processor set */ 98*7c478bd9Sstevel@tonic-gate } pool_resource_elem_class_t; 99*7c478bd9Sstevel@tonic-gate 100*7c478bd9Sstevel@tonic-gate typedef enum pool_component_elem_class { 101*7c478bd9Sstevel@tonic-gate PCEC_INVALID = 0, 102*7c478bd9Sstevel@tonic-gate PCEC_CPU /* CPU */ 103*7c478bd9Sstevel@tonic-gate } pool_component_elem_class_t; 104*7c478bd9Sstevel@tonic-gate 105*7c478bd9Sstevel@tonic-gate /* 106*7c478bd9Sstevel@tonic-gate * Constants used by devpool. 107*7c478bd9Sstevel@tonic-gate */ 108*7c478bd9Sstevel@tonic-gate #define POOL_IDLIST_SIZE 1024 109*7c478bd9Sstevel@tonic-gate #define POOL_PROPNAME_SIZE 8192 110*7c478bd9Sstevel@tonic-gate #define POOL_PROPBUF_SIZE 65535 111*7c478bd9Sstevel@tonic-gate 112*7c478bd9Sstevel@tonic-gate typedef struct pool_status { 113*7c478bd9Sstevel@tonic-gate int ps_io_state; 114*7c478bd9Sstevel@tonic-gate } pool_status_t; 115*7c478bd9Sstevel@tonic-gate 116*7c478bd9Sstevel@tonic-gate typedef struct pool_create { 117*7c478bd9Sstevel@tonic-gate id_t pc_i_id; 118*7c478bd9Sstevel@tonic-gate int pc_o_type; 119*7c478bd9Sstevel@tonic-gate int pc_o_sub_type; 120*7c478bd9Sstevel@tonic-gate } pool_create_t; 121*7c478bd9Sstevel@tonic-gate 122*7c478bd9Sstevel@tonic-gate typedef struct pool_destroy { 123*7c478bd9Sstevel@tonic-gate int pd_o_type; 124*7c478bd9Sstevel@tonic-gate int pd_o_sub_type; 125*7c478bd9Sstevel@tonic-gate id_t pd_o_id; 126*7c478bd9Sstevel@tonic-gate } pool_destroy_t; 127*7c478bd9Sstevel@tonic-gate 128*7c478bd9Sstevel@tonic-gate typedef struct pool_query { 129*7c478bd9Sstevel@tonic-gate size_t pq_io_bufsize; 130*7c478bd9Sstevel@tonic-gate void *pq_io_buf; 131*7c478bd9Sstevel@tonic-gate } pool_query_t; 132*7c478bd9Sstevel@tonic-gate 133*7c478bd9Sstevel@tonic-gate #ifdef _SYSCALL32 134*7c478bd9Sstevel@tonic-gate typedef struct pool_query32 { 135*7c478bd9Sstevel@tonic-gate size32_t pq_io_bufsize; 136*7c478bd9Sstevel@tonic-gate caddr32_t pq_io_buf; 137*7c478bd9Sstevel@tonic-gate } pool_query32_t; 138*7c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */ 139*7c478bd9Sstevel@tonic-gate 140*7c478bd9Sstevel@tonic-gate typedef struct pool_assoc { 141*7c478bd9Sstevel@tonic-gate poolid_t pa_o_pool_id; 142*7c478bd9Sstevel@tonic-gate pool_resource_elem_class_t pa_o_id_type; 143*7c478bd9Sstevel@tonic-gate id_t pa_o_res_id; 144*7c478bd9Sstevel@tonic-gate } pool_assoc_t; 145*7c478bd9Sstevel@tonic-gate 146*7c478bd9Sstevel@tonic-gate typedef struct pool_dissoc { 147*7c478bd9Sstevel@tonic-gate poolid_t pd_o_pool_id; 148*7c478bd9Sstevel@tonic-gate pool_resource_elem_class_t pd_o_id_type; 149*7c478bd9Sstevel@tonic-gate } pool_dissoc_t; 150*7c478bd9Sstevel@tonic-gate 151*7c478bd9Sstevel@tonic-gate #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4 152*7c478bd9Sstevel@tonic-gate #pragma pack(4) 153*7c478bd9Sstevel@tonic-gate #endif 154*7c478bd9Sstevel@tonic-gate 155*7c478bd9Sstevel@tonic-gate typedef struct pool_transfer { 156*7c478bd9Sstevel@tonic-gate pool_resource_elem_class_t pt_o_id_type; 157*7c478bd9Sstevel@tonic-gate id_t pt_o_src_id; 158*7c478bd9Sstevel@tonic-gate id_t pt_o_tgt_id; 159*7c478bd9Sstevel@tonic-gate uint64_t pt_o_qty; 160*7c478bd9Sstevel@tonic-gate } pool_transfer_t; 161*7c478bd9Sstevel@tonic-gate 162*7c478bd9Sstevel@tonic-gate #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4 163*7c478bd9Sstevel@tonic-gate #pragma pack() 164*7c478bd9Sstevel@tonic-gate #endif 165*7c478bd9Sstevel@tonic-gate 166*7c478bd9Sstevel@tonic-gate typedef struct pool_xtransfer { 167*7c478bd9Sstevel@tonic-gate pool_resource_elem_class_t px_o_id_type; 168*7c478bd9Sstevel@tonic-gate id_t px_o_src_id; 169*7c478bd9Sstevel@tonic-gate id_t px_o_tgt_id; 170*7c478bd9Sstevel@tonic-gate uint_t px_o_complist_size; 171*7c478bd9Sstevel@tonic-gate id_t *px_o_comp_list; 172*7c478bd9Sstevel@tonic-gate } pool_xtransfer_t; 173*7c478bd9Sstevel@tonic-gate 174*7c478bd9Sstevel@tonic-gate #ifdef _SYSCALL32 175*7c478bd9Sstevel@tonic-gate typedef struct pool_xtransfer32 { 176*7c478bd9Sstevel@tonic-gate pool_resource_elem_class_t px_o_id_type; 177*7c478bd9Sstevel@tonic-gate id_t px_o_src_id; 178*7c478bd9Sstevel@tonic-gate id_t px_o_tgt_id; 179*7c478bd9Sstevel@tonic-gate uint_t px_o_complist_size; 180*7c478bd9Sstevel@tonic-gate caddr32_t px_o_comp_list; 181*7c478bd9Sstevel@tonic-gate } pool_xtransfer32_t; 182*7c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */ 183*7c478bd9Sstevel@tonic-gate 184*7c478bd9Sstevel@tonic-gate typedef struct pool_propget { 185*7c478bd9Sstevel@tonic-gate size_t pp_i_bufsize; 186*7c478bd9Sstevel@tonic-gate char *pp_i_buf; 187*7c478bd9Sstevel@tonic-gate pool_elem_class_t pp_o_id_type; 188*7c478bd9Sstevel@tonic-gate pool_resource_elem_class_t pp_o_id_subtype; 189*7c478bd9Sstevel@tonic-gate id_t pp_o_id; 190*7c478bd9Sstevel@tonic-gate uint_t pp_o_prop_name_size; 191*7c478bd9Sstevel@tonic-gate char *pp_o_prop_name; 192*7c478bd9Sstevel@tonic-gate } pool_propget_t; 193*7c478bd9Sstevel@tonic-gate 194*7c478bd9Sstevel@tonic-gate #ifdef _SYSCALL32 195*7c478bd9Sstevel@tonic-gate typedef struct pool_propget32 { 196*7c478bd9Sstevel@tonic-gate size32_t pp_i_bufsize; 197*7c478bd9Sstevel@tonic-gate caddr32_t pp_i_buf; 198*7c478bd9Sstevel@tonic-gate pool_elem_class_t pp_o_id_type; 199*7c478bd9Sstevel@tonic-gate pool_resource_elem_class_t pp_o_id_subtype; 200*7c478bd9Sstevel@tonic-gate id_t pp_o_id; 201*7c478bd9Sstevel@tonic-gate uint_t pp_o_prop_name_size; 202*7c478bd9Sstevel@tonic-gate caddr32_t pp_o_prop_name; 203*7c478bd9Sstevel@tonic-gate } pool_propget32_t; 204*7c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */ 205*7c478bd9Sstevel@tonic-gate 206*7c478bd9Sstevel@tonic-gate typedef struct pool_propgetall { 207*7c478bd9Sstevel@tonic-gate size_t pp_i_proplist_size; 208*7c478bd9Sstevel@tonic-gate char *pp_i_prop_list; 209*7c478bd9Sstevel@tonic-gate pool_elem_class_t pp_o_id_type; 210*7c478bd9Sstevel@tonic-gate pool_resource_elem_class_t pp_o_id_sub_type; 211*7c478bd9Sstevel@tonic-gate id_t pp_o_id; 212*7c478bd9Sstevel@tonic-gate } pool_propgetall_t; 213*7c478bd9Sstevel@tonic-gate 214*7c478bd9Sstevel@tonic-gate #ifdef _SYSCALL32 215*7c478bd9Sstevel@tonic-gate typedef struct pool_propgetall32 { 216*7c478bd9Sstevel@tonic-gate size32_t pp_i_proplist_size; 217*7c478bd9Sstevel@tonic-gate caddr32_t pp_i_prop_list; 218*7c478bd9Sstevel@tonic-gate pool_elem_class_t pp_o_id_type; 219*7c478bd9Sstevel@tonic-gate pool_resource_elem_class_t pp_o_id_sub_type; 220*7c478bd9Sstevel@tonic-gate id_t pp_o_id; 221*7c478bd9Sstevel@tonic-gate } pool_propgetall32_t; 222*7c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */ 223*7c478bd9Sstevel@tonic-gate 224*7c478bd9Sstevel@tonic-gate typedef struct pool_propput { 225*7c478bd9Sstevel@tonic-gate pool_elem_class_t pp_o_id_type; 226*7c478bd9Sstevel@tonic-gate pool_resource_elem_class_t pp_o_id_sub_type; 227*7c478bd9Sstevel@tonic-gate id_t pp_o_id; 228*7c478bd9Sstevel@tonic-gate size_t pp_o_bufsize; 229*7c478bd9Sstevel@tonic-gate char *pp_o_buf; 230*7c478bd9Sstevel@tonic-gate } pool_propput_t; 231*7c478bd9Sstevel@tonic-gate 232*7c478bd9Sstevel@tonic-gate #ifdef _SYSCALL32 233*7c478bd9Sstevel@tonic-gate typedef struct pool_propput32 { 234*7c478bd9Sstevel@tonic-gate pool_elem_class_t pp_o_id_type; 235*7c478bd9Sstevel@tonic-gate pool_resource_elem_class_t pp_o_id_sub_type; 236*7c478bd9Sstevel@tonic-gate id_t pp_o_id; 237*7c478bd9Sstevel@tonic-gate size32_t pp_o_bufsize; 238*7c478bd9Sstevel@tonic-gate caddr32_t pp_o_buf; 239*7c478bd9Sstevel@tonic-gate } pool_propput32_t; 240*7c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */ 241*7c478bd9Sstevel@tonic-gate 242*7c478bd9Sstevel@tonic-gate typedef struct pool_proprm { 243*7c478bd9Sstevel@tonic-gate pool_elem_class_t pp_o_id_type; 244*7c478bd9Sstevel@tonic-gate pool_resource_elem_class_t pp_o_id_sub_type; 245*7c478bd9Sstevel@tonic-gate id_t pp_o_id; 246*7c478bd9Sstevel@tonic-gate size_t pp_o_prop_name_size; 247*7c478bd9Sstevel@tonic-gate char *pp_o_prop_name; 248*7c478bd9Sstevel@tonic-gate } pool_proprm_t; 249*7c478bd9Sstevel@tonic-gate 250*7c478bd9Sstevel@tonic-gate #ifdef _SYSCALL32 251*7c478bd9Sstevel@tonic-gate typedef struct pool_proprm32 { 252*7c478bd9Sstevel@tonic-gate pool_elem_class_t pp_o_id_type; 253*7c478bd9Sstevel@tonic-gate pool_resource_elem_class_t pp_o_id_sub_type; 254*7c478bd9Sstevel@tonic-gate id_t pp_o_id; 255*7c478bd9Sstevel@tonic-gate size32_t pp_o_prop_name_size; 256*7c478bd9Sstevel@tonic-gate caddr32_t pp_o_prop_name; 257*7c478bd9Sstevel@tonic-gate } pool_proprm32_t; 258*7c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */ 259*7c478bd9Sstevel@tonic-gate 260*7c478bd9Sstevel@tonic-gate typedef struct pool_bind { 261*7c478bd9Sstevel@tonic-gate idtype_t pb_o_id_type; 262*7c478bd9Sstevel@tonic-gate id_t pb_o_pool_id; 263*7c478bd9Sstevel@tonic-gate id_t pb_o_id; 264*7c478bd9Sstevel@tonic-gate } pool_bind_t; 265*7c478bd9Sstevel@tonic-gate 266*7c478bd9Sstevel@tonic-gate typedef struct pool_bindq { 267*7c478bd9Sstevel@tonic-gate idtype_t pb_o_id_type; 268*7c478bd9Sstevel@tonic-gate poolid_t pb_i_id; 269*7c478bd9Sstevel@tonic-gate id_t pb_o_id; 270*7c478bd9Sstevel@tonic-gate } pool_bindq_t; 271*7c478bd9Sstevel@tonic-gate 272*7c478bd9Sstevel@tonic-gate /* 273*7c478bd9Sstevel@tonic-gate * Values for pp_type below 274*7c478bd9Sstevel@tonic-gate */ 275*7c478bd9Sstevel@tonic-gate #define PP_READ 0x0001 276*7c478bd9Sstevel@tonic-gate #define PP_WRITE 0x0002 277*7c478bd9Sstevel@tonic-gate #define PP_RDWR 0x0003 278*7c478bd9Sstevel@tonic-gate #define PP_OPTIONAL 0x0004 279*7c478bd9Sstevel@tonic-gate #define PP_STORED 0x0008 280*7c478bd9Sstevel@tonic-gate #define PP_INIT 0x0010 281*7c478bd9Sstevel@tonic-gate #define PP_HIDDEN 0x0020 282*7c478bd9Sstevel@tonic-gate 283*7c478bd9Sstevel@tonic-gate #ifdef _KERNEL 284*7c478bd9Sstevel@tonic-gate 285*7c478bd9Sstevel@tonic-gate /* 286*7c478bd9Sstevel@tonic-gate * For special properties 287*7c478bd9Sstevel@tonic-gate */ 288*7c478bd9Sstevel@tonic-gate typedef struct pool_property { 289*7c478bd9Sstevel@tonic-gate char *pp_name; /* name of the property */ 290*7c478bd9Sstevel@tonic-gate data_type_t pp_type; /* type of the property */ 291*7c478bd9Sstevel@tonic-gate int pp_perm; /* permissions */ 292*7c478bd9Sstevel@tonic-gate } pool_property_t; 293*7c478bd9Sstevel@tonic-gate 294*7c478bd9Sstevel@tonic-gate extern int pool_propput_common(nvlist_t *, nvpair_t *, pool_property_t *); 295*7c478bd9Sstevel@tonic-gate extern int pool_proprm_common(nvlist_t *, char *, pool_property_t *); 296*7c478bd9Sstevel@tonic-gate 297*7c478bd9Sstevel@tonic-gate #endif /* _KERNEL */ 298*7c478bd9Sstevel@tonic-gate 299*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 300*7c478bd9Sstevel@tonic-gate } 301*7c478bd9Sstevel@tonic-gate #endif 302*7c478bd9Sstevel@tonic-gate 303*7c478bd9Sstevel@tonic-gate #endif /* _SYS_POOL_IMPL_H */ 304