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