ses2_element_ctl.c revision 6316:40d5384cc8b2
1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21/* 22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 23 * Use is subject to license terms. 24 */ 25 26#pragma ident "%Z%%M% %I% %E% SMI" 27 28#include <sys/types.h> 29#include <stddef.h> 30#include <stdio.h> 31#include <string.h> 32#include <libnvpair.h> 33 34#include <scsi/libses.h> 35#include "ses2_impl.h" 36 37static int 38elem_setprop_device(ses_plugin_t *sp, ses_node_t *np, ses2_diag_page_t page, 39 nvpair_t *nvp) 40{ 41 ses2_device_ctl_impl_t *dip; 42 const char *name; 43 boolean_t v; 44 45 if ((dip = ses_plugin_ctlpage_lookup(sp, ses_node_snapshot(np), 46 page, 0, np, B_FALSE)) == NULL) 47 return (-1); 48 49 name = nvpair_name(nvp); 50 (void) nvpair_value_boolean_value(nvp, &v); 51 52 if (strcmp(name, SES_PROP_IDENT) == 0) 53 dip->sdci_rqst_ident = v; 54 else if (strcmp(name, SES_PROP_RMV) == 0) 55 dip->sdci_rqst_remove = v; 56 else if (strcmp(name, SES_DEV_PROP_READY_TO_INSERT) == 0) 57 dip->sdci_rqst_insert = v; 58 else if (strcmp(name, SES_DEV_PROP_REQ_MISSING) == 0) 59 dip->sdci_rqst_missing = v; 60 else if (strcmp(name, SES_DEV_PROP_DO_NOT_REMOVE) == 0) 61 dip->sdci_do_not_remove = v; 62 else if (strcmp(name, SES_DEV_PROP_REQ_ACTIVE) == 0) 63 dip->sdci_rqst_active = v; 64 else if (strcmp(name, SES_DEV_PROP_BYP_B) == 0) 65 dip->sdci_enable_byp_b = v; 66 else if (strcmp(name, SES_DEV_PROP_BYP_A) == 0) 67 dip->sdci_enable_byp_a = v; 68 else if (strcmp(name, SES_PROP_OFF) == 0) 69 dip->sdci_device_off = v; 70 else if (strcmp(name, SES_DEV_PROP_FAULT_RQSTD) == 0) 71 dip->sdci_rqst_fault = v; 72 else 73 ses_panic("Bad property %s", name); 74 75 return (0); 76} 77 78static int 79elem_setprop_psu(ses_plugin_t *sp, ses_node_t *np, ses2_diag_page_t page, 80 nvpair_t *nvp) 81{ 82 ses2_psu_ctl_impl_t *pip; 83 const char *name; 84 boolean_t v; 85 86 if ((pip = ses_plugin_ctlpage_lookup(sp, ses_node_snapshot(np), 87 page, 0, np, B_FALSE)) == NULL) 88 return (-1); 89 90 name = nvpair_name(nvp); 91 (void) nvpair_value_boolean_value(nvp, &v); 92 93 if (strcmp(name, SES_PROP_IDENT) == 0) 94 pip->spci_rqst_ident = v; 95 else if (strcmp(name, SES_PROP_REQUESTED_ON) == 0) 96 pip->spci_rqst_on = v; 97 else if (strcmp(name, SES_PROP_FAIL) == 0) 98 pip->spci_rqst_fail = v; 99 else 100 ses_panic("Bad property %s", name); 101 102 return (0); 103} 104 105static int 106elem_setprop_cooling(ses_plugin_t *sp, ses_node_t *np, ses2_diag_page_t page, 107 nvpair_t *nvp) 108{ 109 ses2_cooling_ctl_impl_t *cip; 110 const char *name; 111 boolean_t v1; 112 uint64_t v64; 113 114 if ((cip = ses_plugin_ctlpage_lookup(sp, ses_node_snapshot(np), 115 page, 0, np, B_FALSE)) == NULL) 116 return (-1); 117 118 name = nvpair_name(nvp); 119 120 if (strcmp(name, SES_COOLING_PROP_SPEED_CODE) == 0) { 121 (void) nvpair_value_uint64(nvp, &v64); 122 cip->scci_requested_speed_code = v64; 123 return (0); 124 } 125 126 (void) nvpair_value_boolean_value(nvp, &v1); 127 128 if (strcmp(name, SES_PROP_IDENT) == 0) 129 cip->scci_rqst_ident = v1; 130 else if (strcmp(name, SES_PROP_REQUESTED_ON) == 0) 131 cip->scci_rqst_on = v1; 132 else if (strcmp(name, SES_PROP_FAIL) == 0) 133 cip->scci_rqst_fail = v1; 134 else 135 ses_panic("Bad property %s", name); 136 137 return (0); 138} 139 140static int 141elem_setprop_temp(ses_plugin_t *sp, ses_node_t *np, ses2_diag_page_t page, 142 nvpair_t *nvp) 143{ 144 ses2_temp_ctl_impl_t *tip; 145 const char *name; 146 boolean_t v; 147 148 if ((tip = ses_plugin_ctlpage_lookup(sp, ses_node_snapshot(np), 149 page, 0, np, B_FALSE)) == NULL) 150 return (-1); 151 152 name = nvpair_name(nvp); 153 (void) nvpair_value_boolean_value(nvp, &v); 154 155 if (strcmp(name, SES_PROP_FAIL) == 0) 156 tip->stci_rqst_fail = v; 157 else if (strcmp(name, SES_PROP_IDENT) == 0) 158 tip->stci_rqst_ident = v; 159 else 160 ses_panic("Bad property %s", name); 161 162 return (0); 163} 164 165static int 166elem_setprop_lock(ses_plugin_t *sp, ses_node_t *np, ses2_diag_page_t page, 167 nvpair_t *nvp) 168{ 169 ses2_lock_ctl_impl_t *lip; 170 const char *name; 171 boolean_t v; 172 173 if ((lip = ses_plugin_ctlpage_lookup(sp, ses_node_snapshot(np), 174 page, 0, np, B_FALSE)) == NULL) 175 return (-1); 176 177 name = nvpair_name(nvp); 178 (void) nvpair_value_boolean_value(nvp, &v); 179 180 if (strcmp(name, SES_PROP_FAIL) == 0) 181 lip->slci_rqst_fail = v; 182 else if (strcmp(name, SES_PROP_IDENT) == 0) 183 lip->slci_rqst_ident = v; 184 else if (strcmp(name, SES_LOCK_PROP_UNLOCKED) == 0) 185 lip->slci_unlock = v; 186 else 187 ses_panic("Bad property %s", name); 188 189 return (0); 190} 191 192static int 193elem_setprop_alarm(ses_plugin_t *sp, ses_node_t *np, ses2_diag_page_t page, 194 nvpair_t *nvp) 195{ 196 ses2_alarm_ctl_impl_t *aip; 197 const char *name; 198 boolean_t v; 199 200 if ((aip = ses_plugin_ctlpage_lookup(sp, ses_node_snapshot(np), 201 page, 0, np, B_FALSE)) == NULL) 202 return (-1); 203 204 name = nvpair_name(nvp); 205 (void) nvpair_value_boolean_value(nvp, &v); 206 207 if (strcmp(name, SES_PROP_FAIL) == 0) 208 aip->saci_rqst_fail = v; 209 else if (strcmp(name, SES_PROP_IDENT) == 0) 210 aip->saci_rqst_ident = v; 211 else if (strcmp(name, SES_ALARM_PROP_UNRECOV) == 0) 212 aip->saci_unrecov = v; 213 else if (strcmp(name, SES_ALARM_PROP_CRIT) == 0) 214 aip->saci_crit = v; 215 else if (strcmp(name, SES_ALARM_PROP_NONCRIT) == 0) 216 aip->saci_noncrit = v; 217 else if (strcmp(name, SES_ALARM_PROP_INFO) == 0) 218 aip->saci_info = v; 219 else if (strcmp(name, SES_ALARM_PROP_REMIND) == 0) 220 aip->saci_set_remind = v; 221 else if (strcmp(name, SES_ALARM_PROP_MUTED) == 0) 222 aip->saci_set_mute = v; 223 else 224 ses_panic("Bad property %s", name); 225 226 return (0); 227} 228 229static int 230elem_setprop_esc(ses_plugin_t *sp, ses_node_t *np, ses2_diag_page_t page, 231 nvpair_t *nvp) 232{ 233 ses2_controller_ctl_impl_t *cip; 234 const char *name; 235 boolean_t v; 236 237 if ((cip = ses_plugin_ctlpage_lookup(sp, ses_node_snapshot(np), 238 page, 0, np, B_FALSE)) == NULL) 239 return (-1); 240 241 name = nvpair_name(nvp); 242 (void) nvpair_value_boolean_value(nvp, &v); 243 244 if (strcmp(name, SES_PROP_FAIL) == 0) 245 cip->scci_rqst_fail = v; 246 else if (strcmp(name, SES_PROP_IDENT) == 0) 247 cip->scci_rqst_ident = v; 248 else if (strcmp(name, SES_ESC_PROP_SELECT) == 0) 249 cip->scci_select_element = v; 250 else 251 ses_panic("Bad property %s", name); 252 253 return (0); 254} 255 256static int 257elem_setprop_scc(ses_plugin_t *sp, ses_node_t *np, ses2_diag_page_t page, 258 nvpair_t *nvp) 259{ 260 ses2_scc_ctl_impl_t *sip; 261 const char *name; 262 boolean_t v; 263 264 if ((sip = ses_plugin_ctlpage_lookup(sp, ses_node_snapshot(np), 265 page, 0, np, B_FALSE)) == NULL) 266 return (-1); 267 268 name = nvpair_name(nvp); 269 (void) nvpair_value_boolean_value(nvp, &v); 270 271 if (strcmp(name, SES_PROP_FAIL) == 0) 272 sip->ssci_rqst_fail = v; 273 else if (strcmp(name, SES_PROP_IDENT) == 0) 274 sip->ssci_rqst_ident = v; 275 else 276 ses_panic("Bad property %s", name); 277 278 return (0); 279} 280 281static int 282elem_setprop_ups(ses_plugin_t *sp, ses_node_t *np, ses2_diag_page_t page, 283 nvpair_t *nvp) 284{ 285 ses2_ups_ctl_impl_t *uip; 286 const char *name; 287 boolean_t v; 288 289 if ((uip = ses_plugin_ctlpage_lookup(sp, ses_node_snapshot(np), 290 page, 0, np, B_FALSE)) == NULL) 291 return (-1); 292 293 name = nvpair_name(nvp); 294 (void) nvpair_value_boolean_value(nvp, &v); 295 296 if (strcmp(name, SES_PROP_FAIL) == 0) 297 uip->suci_rqst_fail = v; 298 else if (strcmp(name, SES_PROP_IDENT) == 0) 299 uip->suci_rqst_ident = v; 300 else 301 ses_panic("Bad property %s", name); 302 303 return (0); 304} 305 306static int 307elem_setprop_cache(ses_plugin_t *sp, ses_node_t *np, ses2_diag_page_t page, 308 nvpair_t *nvp) 309{ 310 ses2_nvcache_ctl_impl_t *cip; 311 const char *name; 312 boolean_t v; 313 314 if ((cip = ses_plugin_ctlpage_lookup(sp, ses_node_snapshot(np), 315 page, 0, np, B_FALSE)) == NULL) 316 return (-1); 317 318 name = nvpair_name(nvp); 319 (void) nvpair_value_boolean_value(nvp, &v); 320 321 if (strcmp(name, SES_PROP_FAIL) == 0) 322 cip->snci_rqst_fail = v; 323 else if (strcmp(name, SES_PROP_IDENT) == 0) 324 cip->snci_rqst_ident = v; 325 else 326 ses_panic("Bad property %s", name); 327 328 return (0); 329} 330 331static int 332elem_setprop_keypad(ses_plugin_t *sp, ses_node_t *np, ses2_diag_page_t page, 333 nvpair_t *nvp) 334{ 335 ses2_keypad_ctl_impl_t *kip; 336 const char *name; 337 boolean_t v; 338 339 if ((kip = ses_plugin_ctlpage_lookup(sp, ses_node_snapshot(np), 340 page, 0, np, B_FALSE)) == NULL) 341 return (-1); 342 343 name = nvpair_name(nvp); 344 (void) nvpair_value_boolean_value(nvp, &v); 345 346 if (strcmp(name, SES_PROP_FAIL) == 0) 347 kip->skci_rqst_fail = v; 348 else if (strcmp(name, SES_PROP_IDENT) == 0) 349 kip->skci_rqst_ident = v; 350 else 351 ses_panic("Bad property %s", name); 352 353 return (0); 354} 355 356static int 357elem_setprop_display(ses_plugin_t *sp, ses_node_t *np, ses2_diag_page_t page, 358 nvpair_t *nvp) 359{ 360 ses2_display_ctl_impl_t *dip; 361 const char *name; 362 boolean_t v1; 363 uint16_t v16; 364 uint64_t v64; 365 366 if ((dip = ses_plugin_ctlpage_lookup(sp, ses_node_snapshot(np), 367 page, 0, np, B_FALSE)) == NULL) 368 return (-1); 369 370 371 name = nvpair_name(nvp); 372 373 if (strcmp(name, SES_DPY_PROP_MODE) == 0) { 374 (void) nvpair_value_uint64(nvp, &v64); 375 dip->sdci_display_mode = v64; 376 return (0); 377 } else if (strcmp(name, SES_DPY_PROP_CHAR) == 0) { 378 (void) nvpair_value_uint16(nvp, &v16); 379 SCSI_WRITE16(&dip->sdci_display_character, v16); 380 return (0); 381 } 382 383 (void) nvpair_value_boolean_value(nvp, &v1); 384 385 if (strcmp(name, SES_PROP_FAIL) == 0) 386 dip->sdci_rqst_fail = v1; 387 else if (strcmp(name, SES_PROP_IDENT) == 0) 388 dip->sdci_rqst_ident = v1; 389 else 390 ses_panic("Bad property %s", name); 391 return (0); 392} 393 394static int 395elem_setprop_px(ses_plugin_t *sp, ses_node_t *np, ses2_diag_page_t page, 396 nvpair_t *nvp) 397{ 398 ses2_port_ctl_impl_t *pip; 399 const char *name; 400 boolean_t v; 401 402 if ((pip = ses_plugin_ctlpage_lookup(sp, ses_node_snapshot(np), 403 page, 0, np, B_FALSE)) == NULL) 404 return (-1); 405 406 name = nvpair_name(nvp); 407 408 (void) nvpair_value_boolean_value(nvp, &v); 409 410 if (strcmp(name, SES_PROP_FAIL) == 0) 411 pip->spci_rqst_fail = v; 412 else if (strcmp(name, SES_PROP_IDENT) == 0) 413 pip->spci_rqst_ident = v; 414 else if (strcmp(name, SES_PROP_DISABLED) == 0) 415 pip->spci_disable = v; 416 else 417 ses_panic("Bad property %s", name); 418 419 return (0); 420} 421 422static int 423elem_setprop_lang(ses_plugin_t *sp, ses_node_t *np, ses2_diag_page_t page, 424 nvpair_t *nvp) 425{ 426 ses2_lang_ctl_impl_t *lip; 427 const char *name; 428 boolean_t v1; 429 uint64_t v64; 430 431 if ((lip = ses_plugin_ctlpage_lookup(sp, ses_node_snapshot(np), 432 page, 0, np, B_FALSE)) == NULL) 433 return (-1); 434 435 name = nvpair_name(nvp); 436 437 if (strcmp(name, SES_LANG_PROP_LANGCODE) == 0) { 438 (void) nvpair_value_uint64(nvp, &v64); 439 SCSI_WRITE16(&lip->slci_language_code, v64); 440 return (0); 441 } 442 443 (void) nvpair_value_boolean_value(nvp, &v1); 444 445 if (strcmp(name, SES_PROP_IDENT) == 0) 446 lip->slci_rqst_ident = v1; 447 else 448 ses_panic("Bad property %s", name); 449 450 return (0); 451} 452 453static int 454elem_setprop_comm(ses_plugin_t *sp, ses_node_t *np, ses2_diag_page_t page, 455 nvpair_t *nvp) 456{ 457 ses2_comm_ctl_impl_t *cip; 458 const char *name; 459 boolean_t v; 460 461 if ((cip = ses_plugin_ctlpage_lookup(sp, ses_node_snapshot(np), 462 page, 0, np, B_FALSE)) == NULL) 463 return (-1); 464 465 name = nvpair_name(nvp); 466 (void) nvpair_value_boolean_value(nvp, &v); 467 468 if (strcmp(name, SES_PROP_FAIL) == 0) 469 cip->scci_rqst_fail = v; 470 else if (strcmp(name, SES_PROP_IDENT) == 0) 471 cip->scci_rqst_ident = v; 472 else if (strcmp(name, SES_PROP_DISABLED) == 0) 473 cip->scci_disable = v; 474 else 475 ses_panic("Bad property %s", name); 476 477 return (0); 478} 479 480static int 481elem_setprop_voltage(ses_plugin_t *sp, ses_node_t *np, ses2_diag_page_t page, 482 nvpair_t *nvp) 483{ 484 ses2_voltage_ctl_impl_t *vip; 485 const char *name; 486 boolean_t v; 487 488 if ((vip = ses_plugin_ctlpage_lookup(sp, ses_node_snapshot(np), 489 page, 0, np, B_FALSE)) == NULL) 490 return (-1); 491 492 name = nvpair_name(nvp); 493 (void) nvpair_value_boolean_value(nvp, &v); 494 495 if (strcmp(name, SES_PROP_FAIL) == 0) 496 vip->svci_rqst_fail = v; 497 else if (strcmp(name, SES_PROP_IDENT) == 0) 498 vip->svci_rqst_ident = v; 499 else 500 ses_panic("Bad property %s", name); 501 502 return (0); 503} 504 505static int 506elem_setprop_current(ses_plugin_t *sp, ses_node_t *np, ses2_diag_page_t page, 507 nvpair_t *nvp) 508{ 509 ses2_current_ctl_impl_t *cip; 510 const char *name; 511 boolean_t v; 512 513 if ((cip = ses_plugin_ctlpage_lookup(sp, ses_node_snapshot(np), 514 page, 0, np, B_FALSE)) == NULL) 515 return (-1); 516 517 name = nvpair_name(nvp); 518 (void) nvpair_value_boolean_value(nvp, &v); 519 520 if (strcmp(name, SES_PROP_FAIL) == 0) 521 cip->scci_rqst_fail = v; 522 else if (strcmp(name, SES_PROP_IDENT) == 0) 523 cip->scci_rqst_ident = v; 524 else 525 ses_panic("Bad property %s", name); 526 527 return (0); 528} 529 530static int 531elem_setprop_itp(ses_plugin_t *sp, ses_node_t *np, ses2_diag_page_t page, 532 nvpair_t *nvp) 533{ 534 ses2_itp_ctl_impl_t *iip; 535 const char *name; 536 boolean_t v; 537 538 if ((iip = ses_plugin_ctlpage_lookup(sp, ses_node_snapshot(np), 539 page, 0, np, B_FALSE)) == NULL) 540 return (-1); 541 542 name = nvpair_name(nvp); 543 (void) nvpair_value_boolean_value(nvp, &v); 544 545 if (strcmp(name, SES_PROP_FAIL) == 0) 546 iip->sici_rqst_fail = v; 547 else if (strcmp(name, SES_PROP_IDENT) == 0) 548 iip->sici_rqst_ident = v; 549 else if (strcmp(name, SES_ITP_PROP_ENABLED) == 0) 550 iip->sici_enable = v; 551 else 552 ses_panic("Bad property %s", name); 553 554 return (0); 555} 556 557static int 558elem_setprop_sse(ses_plugin_t *sp, ses_node_t *np, ses2_diag_page_t page, 559 nvpair_t *nvp) 560{ 561 ses2_ss_ctl_impl_t *sip; 562 const char *name; 563 boolean_t v; 564 565 if ((sip = ses_plugin_ctlpage_lookup(sp, ses_node_snapshot(np), 566 page, 0, np, B_FALSE)) == NULL) 567 return (-1); 568 569 name = nvpair_name(nvp); 570 (void) nvpair_value_boolean_value(nvp, &v); 571 572 if (strcmp(name, SES_PROP_FAIL) == 0) 573 sip->ssci_rqst_fail = v; 574 else if (strcmp(name, SES_PROP_IDENT) == 0) 575 sip->ssci_rqst_ident = v; 576 else 577 ses_panic("Bad property %s", name); 578 579 return (0); 580} 581 582static int 583elem_setprop_arraydev(ses_plugin_t *sp, ses_node_t *np, ses2_diag_page_t page, 584 nvpair_t *nvp) 585{ 586 ses2_array_device_ctl_impl_t *aip; 587 const char *name; 588 boolean_t v; 589 590 if ((aip = ses_plugin_ctlpage_lookup(sp, ses_node_snapshot(np), 591 page, 0, np, B_FALSE)) == NULL) 592 return (-1); 593 594 name = nvpair_name(nvp); 595 (void) nvpair_value_boolean_value(nvp, &v); 596 597 if (strcmp(name, SES_AD_PROP_RR_ABORT) == 0) 598 aip->sadci_rqst_rr_abort = v; 599 else if (strcmp(name, SES_AD_PROP_REBUILD) == 0) 600 aip->sadci_rqst_rebuild = v; 601 else if (strcmp(name, SES_AD_PROP_IN_FAILED_ARRAY) == 0) 602 aip->sadci_rqst_in_failed_array = v; 603 else if (strcmp(name, SES_AD_PROP_IN_CRIT_ARRAY) == 0) 604 aip->sadci_rqst_in_crit_array = v; 605 else if (strcmp(name, SES_AD_PROP_CONS_CHK) == 0) 606 aip->sadci_rqst_cons_check = v; 607 else if (strcmp(name, SES_AD_PROP_HOT_SPARE) == 0) 608 aip->sadci_rqst_hot_spare = v; 609 else if (strcmp(name, SES_AD_PROP_RSVD_DEVICE) == 0) 610 aip->sadci_rqst_rsvd_device = v; 611 else if (strcmp(name, SES_PROP_IDENT) == 0) 612 aip->sadci_rqst_ident = v; 613 else if (strcmp(name, SES_PROP_RMV) == 0) 614 aip->sadci_rqst_remove = v; 615 else if (strcmp(name, SES_DEV_PROP_READY_TO_INSERT) == 0) 616 aip->sadci_rqst_insert = v; 617 else if (strcmp(name, SES_DEV_PROP_REQ_MISSING) == 0) 618 aip->sadci_rqst_missing = v; 619 else if (strcmp(name, SES_DEV_PROP_DO_NOT_REMOVE) == 0) 620 aip->sadci_do_not_remove = v; 621 else if (strcmp(name, SES_DEV_PROP_REQ_ACTIVE) == 0) 622 aip->sadci_rqst_active = v; 623 else if (strcmp(name, SES_DEV_PROP_BYP_B) == 0) 624 aip->sadci_enable_byp_b = v; 625 else if (strcmp(name, SES_DEV_PROP_BYP_A) == 0) 626 aip->sadci_enable_byp_a = v; 627 else if (strcmp(name, SES_PROP_OFF) == 0) 628 aip->sadci_device_off = v; 629 else if (strcmp(name, SES_DEV_PROP_FAULT_RQSTD) == 0) 630 aip->sadci_rqst_fault = v; 631 else 632 ses_panic("Bad property %s", name); 633 634 return (0); 635} 636 637static int 638elem_setprop_expander(ses_plugin_t *sp, ses_node_t *np, ses2_diag_page_t page, 639 nvpair_t *nvp) 640{ 641 ses2_expander_ctl_impl_t *eip; 642 const char *name; 643 boolean_t v; 644 645 if ((eip = ses_plugin_ctlpage_lookup(sp, ses_node_snapshot(np), 646 page, 0, np, B_FALSE)) == NULL) 647 return (-1); 648 649 name = nvpair_name(nvp); 650 (void) nvpair_value_boolean_value(nvp, &v); 651 652 if (strcmp(name, SES_PROP_FAIL) == 0) 653 eip->seci_rqst_fail = v; 654 else if (strcmp(name, SES_PROP_IDENT) == 0) 655 eip->seci_rqst_ident = v; 656 else 657 ses_panic("Bad property %s", name); 658 659 return (0); 660} 661 662static int 663elem_setprop_sasconn(ses_plugin_t *sp, ses_node_t *np, ses2_diag_page_t page, 664 nvpair_t *nvp) 665{ 666 ses2_sasconn_ctl_impl_t *sip; 667 const char *name; 668 boolean_t v; 669 670 if ((sip = ses_plugin_ctlpage_lookup(sp, ses_node_snapshot(np), 671 page, 0, np, B_FALSE)) == NULL) 672 return (-1); 673 674 name = nvpair_name(nvp); 675 (void) nvpair_value_boolean_value(nvp, &v); 676 677 if (strcmp(name, SES_PROP_IDENT) == 0) 678 sip->ssci_rqst_ident = v; 679 else if (strcmp(name, SES_PROP_FAIL) == 0) 680 sip->ssci_rqst_fail = v; 681 else 682 ses_panic("Bad property %s", name); 683 684 return (0); 685} 686 687static int 688elem_common_setprop_threshold(ses_plugin_t *sp, ses_node_t *np, 689 ses2_diag_page_t page, nvpair_t *nvp) 690{ 691 ses2_threshold_impl_t *tip; 692 const char *name; 693 uint64_t v; 694 695 ASSERT(page == SES2_DIAGPAGE_THRESHOLD_IO); 696 697 if ((tip = ses_plugin_ctlpage_lookup(sp, ses_node_snapshot(np), 698 page, 0, np, B_FALSE)) == NULL) 699 return (-1); 700 701 name = nvpair_name(nvp); 702 (void) nvpair_value_uint64(nvp, &v); 703 704 if (strcmp(name, SES_PROP_THRESH_CRIT_HI) == 0) 705 tip->sti_high_crit = v; 706 else if (strcmp(name, SES_PROP_THRESH_CRIT_LO) == 0) 707 tip->sti_low_crit = v; 708 else if (strcmp(name, SES_PROP_THRESH_WARN_HI) == 0) 709 tip->sti_high_warn = v; 710 else if (strcmp(name, SES_PROP_THRESH_WARN_LO) == 0) 711 tip->sti_low_warn = v; 712 else 713 ses_panic("Bad property %s", name); 714 715 return (0); 716} 717 718#define SES_THRESHOLD_CTL_PROPS \ 719{ \ 720 .scp_name = SES_PROP_THRESH_CRIT_HI, \ 721 .scp_type = DATA_TYPE_UINT64, \ 722 .scp_num = SES2_DIAGPAGE_THRESHOLD_IO, \ 723 .scp_setprop = elem_common_setprop_threshold \ 724}, \ 725{ \ 726 .scp_name = SES_PROP_THRESH_WARN_HI, \ 727 .scp_type = DATA_TYPE_UINT64, \ 728 .scp_num = SES2_DIAGPAGE_THRESHOLD_IO, \ 729 .scp_setprop = elem_common_setprop_threshold \ 730}, \ 731{ \ 732 .scp_name = SES_PROP_THRESH_CRIT_LO, \ 733 .scp_type = DATA_TYPE_UINT64, \ 734 .scp_num = SES2_DIAGPAGE_THRESHOLD_IO, \ 735 .scp_setprop = elem_common_setprop_threshold \ 736}, \ 737{ \ 738 .scp_name = SES_PROP_THRESH_WARN_LO, \ 739 .scp_type = DATA_TYPE_UINT64, \ 740 .scp_num = SES2_DIAGPAGE_THRESHOLD_IO, \ 741 .scp_setprop = elem_common_setprop_threshold \ 742} 743 744static const ses2_ctl_prop_t device_props[] = { 745 SES_COMMON_CTL_PROPS, 746{ 747 .scp_name = SES_PROP_IDENT, 748 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 749 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 750 .scp_setprop = elem_setprop_device, 751}, 752{ 753 .scp_name = SES_PROP_RMV, 754 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 755 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 756 .scp_setprop = elem_setprop_device, 757}, 758{ 759 .scp_name = SES_DEV_PROP_READY_TO_INSERT, 760 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 761 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 762 .scp_setprop = elem_setprop_device, 763}, 764{ 765 .scp_name = SES_DEV_PROP_REQ_MISSING, 766 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 767 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 768 .scp_setprop = elem_setprop_device, 769}, 770{ 771 .scp_name = SES_DEV_PROP_DO_NOT_REMOVE, 772 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 773 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 774 .scp_setprop = elem_setprop_device, 775}, 776{ 777 .scp_name = SES_DEV_PROP_REQ_ACTIVE, 778 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 779 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 780 .scp_setprop = elem_setprop_device, 781}, 782{ 783 .scp_name = SES_DEV_PROP_BYP_B, 784 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 785 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 786 .scp_setprop = elem_setprop_device, 787}, 788{ 789 .scp_name = SES_DEV_PROP_BYP_A, 790 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 791 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 792 .scp_setprop = elem_setprop_device, 793}, 794{ 795 .scp_name = SES_PROP_OFF, 796 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 797 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 798 .scp_setprop = elem_setprop_device, 799}, 800{ 801 .scp_name = SES_DEV_PROP_FAULT_RQSTD, 802 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 803 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 804 .scp_setprop = elem_setprop_device, 805}, 806{ 807 NULL 808} 809}; 810 811static const ses2_ctl_prop_t psu_props[] = { 812 SES_COMMON_CTL_PROPS, 813{ 814 .scp_name = SES_PROP_IDENT, 815 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 816 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 817 .scp_setprop = elem_setprop_psu 818}, 819{ 820 .scp_name = SES_PROP_REQUESTED_ON, 821 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 822 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 823 .scp_setprop = elem_setprop_psu 824}, 825{ 826 .scp_name = SES_PROP_FAIL, 827 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 828 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 829 .scp_setprop = elem_setprop_psu 830}, 831{ 832 NULL 833} 834}; 835 836static const ses2_ctl_prop_t cooling_props[] = { 837 SES_COMMON_CTL_PROPS, 838{ 839 .scp_name = SES_PROP_IDENT, 840 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 841 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 842 .scp_setprop = elem_setprop_cooling 843}, 844{ 845 .scp_name = SES_COOLING_PROP_SPEED_CODE, 846 .scp_type = DATA_TYPE_UINT64, 847 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 848 .scp_setprop = elem_setprop_cooling 849}, 850{ 851 .scp_name = SES_PROP_REQUESTED_ON, 852 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 853 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 854 .scp_setprop = elem_setprop_cooling 855}, 856{ 857 .scp_name = SES_PROP_FAIL, 858 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 859 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 860 .scp_setprop = elem_setprop_cooling 861}, 862{ 863 NULL 864} 865}; 866 867static const ses2_ctl_prop_t temp_props[] = { 868 SES_COMMON_CTL_PROPS, 869 SES_THRESHOLD_CTL_PROPS, 870{ 871 .scp_name = SES_PROP_FAIL, 872 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 873 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 874 .scp_setprop = elem_setprop_temp 875}, 876{ 877 .scp_name = SES_PROP_IDENT, 878 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 879 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 880 .scp_setprop = elem_setprop_temp 881}, 882{ 883 NULL 884} 885}; 886 887static const ses2_ctl_prop_t lock_props[] = { 888 SES_COMMON_CTL_PROPS, 889{ 890 .scp_name = SES_PROP_FAIL, 891 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 892 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 893 .scp_setprop = elem_setprop_lock 894}, 895{ 896 .scp_name = SES_PROP_IDENT, 897 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 898 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 899 .scp_setprop = elem_setprop_lock 900}, 901{ 902 .scp_name = SES_LOCK_PROP_UNLOCKED, 903 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 904 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 905 .scp_setprop = elem_setprop_lock 906}, 907{ 908 NULL 909} 910}; 911 912static const ses2_ctl_prop_t alarm_props[] = { 913 SES_COMMON_CTL_PROPS, 914{ 915 .scp_name = SES_PROP_FAIL, 916 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 917 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 918 .scp_setprop = elem_setprop_alarm 919}, 920{ 921 .scp_name = SES_PROP_IDENT, 922 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 923 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 924 .scp_setprop = elem_setprop_alarm 925}, 926{ 927 .scp_name = SES_ALARM_PROP_UNRECOV, 928 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 929 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 930 .scp_setprop = elem_setprop_alarm 931}, 932{ 933 .scp_name = SES_ALARM_PROP_CRIT, 934 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 935 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 936 .scp_setprop = elem_setprop_alarm 937}, 938{ 939 .scp_name = SES_ALARM_PROP_NONCRIT, 940 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 941 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 942 .scp_setprop = elem_setprop_alarm 943}, 944{ 945 .scp_name = SES_ALARM_PROP_INFO, 946 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 947 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 948 .scp_setprop = elem_setprop_alarm 949}, 950{ 951 .scp_name = SES_ALARM_PROP_REMIND, 952 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 953 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 954 .scp_setprop = elem_setprop_alarm 955}, 956{ 957 .scp_name = SES_ALARM_PROP_MUTED, 958 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 959 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 960 .scp_setprop = elem_setprop_alarm 961}, 962{ 963 NULL 964} 965}; 966 967static const ses2_ctl_prop_t esc_props[] = { 968 SES_COMMON_CTL_PROPS, 969{ 970 .scp_name = SES_PROP_FAIL, 971 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 972 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 973 .scp_setprop = elem_setprop_esc 974}, 975{ 976 .scp_name = SES_PROP_IDENT, 977 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 978 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 979 .scp_setprop = elem_setprop_esc 980}, 981{ 982 .scp_name = SES_ESC_PROP_SELECT, 983 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 984 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 985 .scp_setprop = elem_setprop_esc 986}, 987{ 988 NULL 989} 990}; 991 992static const ses2_ctl_prop_t scc_props[] = { 993 SES_COMMON_CTL_PROPS, 994{ 995 .scp_name = SES_PROP_FAIL, 996 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 997 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 998 .scp_setprop = elem_setprop_scc 999}, 1000{ 1001 .scp_name = SES_PROP_IDENT, 1002 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 1003 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 1004 .scp_setprop = elem_setprop_scc 1005}, 1006{ 1007 NULL 1008} 1009}; 1010 1011static const ses2_ctl_prop_t cache_props[] = { 1012 SES_COMMON_CTL_PROPS, 1013{ 1014 .scp_name = SES_PROP_FAIL, 1015 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 1016 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 1017 .scp_setprop = elem_setprop_cache 1018}, 1019{ 1020 .scp_name = SES_PROP_IDENT, 1021 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 1022 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 1023 .scp_setprop = elem_setprop_cache 1024}, 1025{ 1026 NULL 1027} 1028}; 1029 1030static const ses2_ctl_prop_t ups_props[] = { 1031 SES_COMMON_CTL_PROPS, 1032 SES_THRESHOLD_CTL_PROPS, 1033{ 1034 .scp_name = SES_PROP_FAIL, 1035 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 1036 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 1037 .scp_setprop = elem_setprop_ups 1038}, 1039{ 1040 .scp_name = SES_PROP_IDENT, 1041 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 1042 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 1043 .scp_setprop = elem_setprop_ups 1044}, 1045{ 1046 NULL 1047} 1048}; 1049 1050static const ses2_ctl_prop_t display_props[] = { 1051 SES_COMMON_CTL_PROPS, 1052{ 1053 .scp_name = SES_DPY_PROP_MODE, 1054 .scp_type = DATA_TYPE_UINT64, 1055 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 1056 .scp_setprop = elem_setprop_display 1057}, 1058{ 1059 .scp_name = SES_PROP_FAIL, 1060 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 1061 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 1062 .scp_setprop = elem_setprop_display 1063}, 1064{ 1065 .scp_name = SES_PROP_IDENT, 1066 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 1067 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 1068 .scp_setprop = elem_setprop_display 1069}, 1070{ 1071 .scp_name = SES_DPY_PROP_CHAR, 1072 .scp_type = DATA_TYPE_UINT16, 1073 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 1074 .scp_setprop = elem_setprop_display 1075}, 1076{ 1077 NULL 1078} 1079}; 1080 1081static const ses2_ctl_prop_t keypad_props[] = { 1082 SES_COMMON_CTL_PROPS, 1083{ 1084 .scp_name = SES_PROP_FAIL, 1085 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 1086 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 1087 .scp_setprop = elem_setprop_keypad 1088}, 1089{ 1090 .scp_name = SES_PROP_IDENT, 1091 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 1092 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 1093 .scp_setprop = elem_setprop_keypad 1094}, 1095{ 1096 NULL 1097} 1098}; 1099 1100static const ses2_ctl_prop_t px_props[] = { 1101 SES_COMMON_CTL_PROPS, 1102{ 1103 .scp_name = SES_PROP_FAIL, 1104 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 1105 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 1106 .scp_setprop = elem_setprop_px 1107}, 1108{ 1109 .scp_name = SES_PROP_IDENT, 1110 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 1111 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 1112 .scp_setprop = elem_setprop_px 1113}, 1114{ 1115 .scp_name = SES_PROP_DISABLED, 1116 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 1117 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 1118 .scp_setprop = elem_setprop_px 1119}, 1120{ 1121 NULL 1122} 1123}; 1124 1125static const ses2_ctl_prop_t lang_props[] = { 1126 SES_COMMON_CTL_PROPS, 1127{ 1128 .scp_name = SES_PROP_IDENT, 1129 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 1130 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 1131 .scp_setprop = elem_setprop_lang 1132}, 1133{ 1134 .scp_name = SES_LANG_PROP_LANGCODE, 1135 .scp_type = DATA_TYPE_UINT64, 1136 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 1137 .scp_setprop = elem_setprop_lang 1138}, 1139{ 1140 NULL 1141} 1142}; 1143 1144static const ses2_ctl_prop_t comm_props[] = { 1145 SES_COMMON_CTL_PROPS, 1146{ 1147 .scp_name = SES_PROP_FAIL, 1148 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 1149 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 1150 .scp_setprop = elem_setprop_comm 1151}, 1152{ 1153 .scp_name = SES_PROP_IDENT, 1154 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 1155 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 1156 .scp_setprop = elem_setprop_comm 1157}, 1158{ 1159 .scp_name = SES_PROP_DISABLED, 1160 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 1161 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 1162 .scp_setprop = elem_setprop_comm 1163}, 1164{ 1165 NULL 1166} 1167}; 1168 1169static const ses2_ctl_prop_t voltage_props[] = { 1170 SES_COMMON_CTL_PROPS, 1171 SES_THRESHOLD_CTL_PROPS, 1172{ 1173 .scp_name = SES_PROP_FAIL, 1174 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 1175 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 1176 .scp_setprop = elem_setprop_voltage 1177}, 1178{ 1179 .scp_name = SES_PROP_IDENT, 1180 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 1181 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 1182 .scp_setprop = elem_setprop_voltage 1183}, 1184{ 1185 NULL 1186} 1187}; 1188 1189static const ses2_ctl_prop_t current_props[] = { 1190 SES_COMMON_CTL_PROPS, 1191 SES_THRESHOLD_CTL_PROPS, 1192{ 1193 .scp_name = SES_PROP_FAIL, 1194 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 1195 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 1196 .scp_setprop = elem_setprop_current 1197}, 1198{ 1199 .scp_name = SES_PROP_IDENT, 1200 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 1201 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 1202 .scp_setprop = elem_setprop_current 1203}, 1204{ 1205 NULL 1206} 1207}; 1208 1209static const ses2_ctl_prop_t itp_props[] = { 1210 SES_COMMON_CTL_PROPS, 1211{ 1212 .scp_name = SES_PROP_FAIL, 1213 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 1214 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 1215 .scp_setprop = elem_setprop_itp 1216}, 1217{ 1218 .scp_name = SES_PROP_IDENT, 1219 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 1220 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 1221 .scp_setprop = elem_setprop_itp 1222}, 1223{ 1224 .scp_name = SES_ITP_PROP_ENABLED, 1225 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 1226 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 1227 .scp_setprop = elem_setprop_itp 1228}, 1229{ 1230 NULL 1231} 1232}; 1233 1234static const ses2_ctl_prop_t sse_props[] = { 1235 SES_COMMON_CTL_PROPS, 1236{ 1237 .scp_name = SES_PROP_FAIL, 1238 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 1239 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 1240 .scp_setprop = elem_setprop_sse 1241}, 1242{ 1243 .scp_name = SES_PROP_IDENT, 1244 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 1245 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 1246 .scp_setprop = elem_setprop_sse 1247}, 1248{ 1249 NULL 1250} 1251}; 1252 1253static const ses2_ctl_prop_t arraydev_props[] = { 1254 SES_COMMON_CTL_PROPS, 1255{ 1256 .scp_name = SES_AD_PROP_RR_ABORT, 1257 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 1258 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 1259 .scp_setprop = elem_setprop_arraydev 1260}, 1261{ 1262 .scp_name = SES_AD_PROP_REBUILD, 1263 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 1264 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 1265 .scp_setprop = elem_setprop_arraydev 1266}, 1267{ 1268 .scp_name = SES_AD_PROP_IN_FAILED_ARRAY, 1269 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 1270 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 1271 .scp_setprop = elem_setprop_arraydev 1272}, 1273{ 1274 .scp_name = SES_AD_PROP_IN_CRIT_ARRAY, 1275 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 1276 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 1277 .scp_setprop = elem_setprop_arraydev 1278}, 1279{ 1280 .scp_name = SES_AD_PROP_CONS_CHK, 1281 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 1282 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 1283 .scp_setprop = elem_setprop_arraydev 1284}, 1285{ 1286 .scp_name = SES_AD_PROP_HOT_SPARE, 1287 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 1288 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 1289 .scp_setprop = elem_setprop_arraydev 1290}, 1291{ 1292 .scp_name = SES_AD_PROP_RSVD_DEVICE, 1293 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 1294 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 1295 .scp_setprop = elem_setprop_arraydev 1296}, 1297{ 1298 .scp_name = SES_AD_PROP_OK, 1299 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 1300 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 1301 .scp_setprop = elem_setprop_arraydev 1302}, 1303{ 1304 .scp_name = SES_PROP_IDENT, 1305 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 1306 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 1307 .scp_setprop = elem_setprop_arraydev 1308}, 1309{ 1310 .scp_name = SES_PROP_RMV, 1311 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 1312 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 1313 .scp_setprop = elem_setprop_arraydev 1314}, 1315{ 1316 .scp_name = SES_DEV_PROP_READY_TO_INSERT, 1317 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 1318 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 1319 .scp_setprop = elem_setprop_arraydev 1320}, 1321{ 1322 .scp_name = SES_DEV_PROP_REQ_MISSING, 1323 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 1324 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 1325 .scp_setprop = elem_setprop_arraydev 1326}, 1327{ 1328 .scp_name = SES_DEV_PROP_DO_NOT_REMOVE, 1329 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 1330 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 1331 .scp_setprop = elem_setprop_arraydev 1332}, 1333{ 1334 .scp_name = SES_DEV_PROP_REQ_ACTIVE, 1335 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 1336 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 1337 .scp_setprop = elem_setprop_arraydev 1338}, 1339{ 1340 .scp_name = SES_DEV_PROP_BYP_B, 1341 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 1342 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 1343 .scp_setprop = elem_setprop_arraydev 1344}, 1345{ 1346 .scp_name = SES_DEV_PROP_BYP_A, 1347 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 1348 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 1349 .scp_setprop = elem_setprop_arraydev 1350}, 1351{ 1352 .scp_name = SES_PROP_OFF, 1353 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 1354 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 1355 .scp_setprop = elem_setprop_arraydev 1356}, 1357{ 1358 .scp_name = SES_DEV_PROP_FAULT_RQSTD, 1359 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 1360 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 1361 .scp_setprop = elem_setprop_arraydev 1362}, 1363{ 1364 NULL 1365} 1366}; 1367 1368static const ses2_ctl_prop_t expander_props[] = { 1369 SES_COMMON_CTL_PROPS, 1370{ 1371 .scp_name = SES_PROP_FAIL, 1372 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 1373 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 1374 .scp_setprop = elem_setprop_expander 1375}, 1376{ 1377 .scp_name = SES_PROP_IDENT, 1378 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 1379 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 1380 .scp_setprop = elem_setprop_expander 1381}, 1382{ 1383 NULL 1384} 1385}; 1386 1387static const ses2_ctl_prop_t sasconn_props[] = { 1388 SES_COMMON_CTL_PROPS, 1389{ 1390 .scp_name = SES_PROP_IDENT, 1391 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 1392 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 1393 .scp_setprop = elem_setprop_sasconn 1394}, 1395{ 1396 .scp_name = SES_PROP_FAIL, 1397 .scp_type = DATA_TYPE_BOOLEAN_VALUE, 1398 .scp_num = SES2_DIAGPAGE_ENCLOSURE_CTL_STATUS, 1399 .scp_setprop = elem_setprop_sasconn 1400}, 1401{ 1402 NULL 1403} 1404}; 1405 1406/*ARGSUSED*/ 1407static int 1408elem_setdef_threshold(ses_node_t *np, ses2_diag_page_t page, void *data) 1409{ 1410 ses2_threshold_impl_t *tip = data; 1411 nvlist_t *props = ses_node_props(np); 1412 1413 SES_NV_CTL64(props, SES_PROP_THRESH_CRIT_HI, tip->sti_high_crit); 1414 SES_NV_CTL64(props, SES_PROP_THRESH_CRIT_LO, tip->sti_low_crit); 1415 SES_NV_CTL64(props, SES_PROP_THRESH_WARN_HI, tip->sti_high_warn); 1416 SES_NV_CTL64(props, SES_PROP_THRESH_WARN_LO, tip->sti_low_warn); 1417 1418 return (0); 1419} 1420 1421/*ARGSUSED*/ 1422static int 1423elem_setdef_device(ses_node_t *np, ses2_diag_page_t page, void *data) 1424{ 1425 ses2_device_ctl_impl_t *dip = data; 1426 nvlist_t *props = ses_node_props(np); 1427 1428 SES_NV_CTLBOOL(props, SES_PROP_IDENT, dip->sdci_rqst_ident); 1429 SES_NV_CTLBOOL(props, SES_PROP_RMV, dip->sdci_rqst_remove); 1430 SES_NV_CTLBOOL(props, SES_DEV_PROP_READY_TO_INSERT, 1431 dip->sdci_rqst_insert); 1432 SES_NV_CTLBOOL(props, SES_DEV_PROP_REQ_MISSING, 1433 dip->sdci_rqst_missing); 1434 SES_NV_CTLBOOL(props, SES_DEV_PROP_DO_NOT_REMOVE, 1435 dip->sdci_do_not_remove); 1436 SES_NV_CTLBOOL(props, SES_DEV_PROP_REQ_ACTIVE, 1437 dip->sdci_rqst_active); 1438 SES_NV_CTLBOOL(props, SES_DEV_PROP_BYP_B, dip->sdci_enable_byp_b); 1439 SES_NV_CTLBOOL(props, SES_DEV_PROP_BYP_A, dip->sdci_enable_byp_a); 1440 SES_NV_CTLBOOL(props, SES_PROP_OFF, dip->sdci_device_off); 1441 SES_NV_CTLBOOL(props, SES_DEV_PROP_FAULT_RQSTD, 1442 dip->sdci_rqst_fault); 1443 1444 return (0); 1445} 1446 1447/*ARGSUSED*/ 1448static int 1449elem_setdef_psu(ses_node_t *np, ses2_diag_page_t page, void *data) 1450{ 1451 ses2_psu_ctl_impl_t *pip = data; 1452 nvlist_t *props = ses_node_props(np); 1453 1454 SES_NV_CTLBOOL(props, SES_PROP_IDENT, pip->spci_rqst_ident); 1455 SES_NV_CTLBOOL(props, SES_PROP_REQUESTED_ON, pip->spci_rqst_on); 1456 SES_NV_CTLBOOL(props, SES_PROP_FAIL, pip->spci_rqst_fail); 1457 1458 return (0); 1459} 1460 1461/*ARGSUSED*/ 1462static int 1463elem_setdef_cooling(ses_node_t *np, ses2_diag_page_t page, void *data) 1464{ 1465 ses2_cooling_ctl_impl_t *cip = data; 1466 nvlist_t *props = ses_node_props(np); 1467 1468 SES_NV_CTLBOOL(props, SES_PROP_IDENT, cip->scci_rqst_ident); 1469 SES_NV_CTL64(props, SES_COOLING_PROP_SPEED_CODE, 1470 cip->scci_requested_speed_code); 1471 SES_NV_CTLBOOL(props, SES_PROP_REQUESTED_ON, cip->scci_rqst_on); 1472 SES_NV_CTLBOOL(props, SES_PROP_FAIL, cip->scci_rqst_fail); 1473 1474 return (0); 1475} 1476 1477/*ARGSUSED*/ 1478static int 1479elem_setdef_temp(ses_node_t *np, ses2_diag_page_t page, void *data) 1480{ 1481 ses2_temp_ctl_impl_t *tip = data; 1482 nvlist_t *props = ses_node_props(np); 1483 1484 if (page == SES2_DIAGPAGE_THRESHOLD_IO) 1485 return (elem_setdef_threshold(np, page, data)); 1486 1487 SES_NV_CTLBOOL(props, SES_PROP_FAIL, tip->stci_rqst_fail); 1488 SES_NV_CTLBOOL(props, SES_PROP_IDENT, tip->stci_rqst_ident); 1489 1490 return (0); 1491} 1492 1493/*ARGSUSED*/ 1494static int 1495elem_setdef_lock(ses_node_t *np, ses2_diag_page_t page, void *data) 1496{ 1497 ses2_lock_ctl_impl_t *lip = data; 1498 nvlist_t *props = ses_node_props(np); 1499 1500 SES_NV_CTLBOOL(props, SES_PROP_FAIL, lip->slci_rqst_fail); 1501 SES_NV_CTLBOOL(props, SES_PROP_IDENT, lip->slci_rqst_ident); 1502 SES_NV_CTLBOOL(props, SES_LOCK_PROP_UNLOCKED, lip->slci_unlock); 1503 1504 return (0); 1505} 1506 1507/*ARGSUSED*/ 1508static int 1509elem_setdef_alarm(ses_node_t *np, ses2_diag_page_t page, void *data) 1510{ 1511 ses2_alarm_ctl_impl_t *aip = data; 1512 nvlist_t *props = ses_node_props(np); 1513 1514 SES_NV_CTLBOOL(props, SES_PROP_FAIL, aip->saci_rqst_fail); 1515 SES_NV_CTLBOOL(props, SES_PROP_IDENT, aip->saci_rqst_ident); 1516 SES_NV_CTLBOOL(props, SES_ALARM_PROP_UNRECOV, aip->saci_unrecov); 1517 SES_NV_CTLBOOL(props, SES_ALARM_PROP_CRIT, aip->saci_crit); 1518 SES_NV_CTLBOOL(props, SES_ALARM_PROP_NONCRIT, aip->saci_noncrit); 1519 SES_NV_CTLBOOL(props, SES_ALARM_PROP_INFO, aip->saci_info); 1520 SES_NV_CTLBOOL(props, SES_ALARM_PROP_REMIND, aip->saci_set_remind); 1521 SES_NV_CTLBOOL(props, SES_ALARM_PROP_MUTED, aip->saci_set_mute); 1522 1523 return (0); 1524} 1525 1526/*ARGSUSED*/ 1527static int 1528elem_setdef_esc(ses_node_t *np, ses2_diag_page_t page, void *data) 1529{ 1530 ses2_controller_ctl_impl_t *cip = data; 1531 nvlist_t *props = ses_node_props(np); 1532 1533 SES_NV_CTLBOOL(props, SES_PROP_FAIL, cip->scci_rqst_fail); 1534 SES_NV_CTLBOOL(props, SES_PROP_IDENT, cip->scci_rqst_ident); 1535 SES_NV_CTLBOOL(props, SES_ESC_PROP_SELECT, 1536 cip->scci_select_element); 1537 1538 return (0); 1539} 1540 1541/*ARGSUSED*/ 1542static int 1543elem_setdef_scc(ses_node_t *np, ses2_diag_page_t page, void *data) 1544{ 1545 ses2_scc_ctl_impl_t *sip = data; 1546 nvlist_t *props = ses_node_props(np); 1547 1548 SES_NV_CTLBOOL(props, SES_PROP_FAIL, sip->ssci_rqst_fail); 1549 SES_NV_CTLBOOL(props, SES_PROP_IDENT, sip->ssci_rqst_ident); 1550 1551 return (0); 1552} 1553 1554/*ARGSUSED*/ 1555static int 1556elem_setdef_cache(ses_node_t *np, ses2_diag_page_t page, void *data) 1557{ 1558 ses2_nvcache_ctl_impl_t *cip = data; 1559 nvlist_t *props = ses_node_props(np); 1560 1561 SES_NV_CTLBOOL(props, SES_PROP_FAIL, cip->snci_rqst_fail); 1562 SES_NV_CTLBOOL(props, SES_PROP_IDENT, cip->snci_rqst_ident); 1563 1564 return (0); 1565} 1566 1567static int 1568elem_setdef_ups(ses_node_t *np, ses2_diag_page_t page, void *data) 1569{ 1570 ses2_ups_ctl_impl_t *uip = data; 1571 nvlist_t *props = ses_node_props(np); 1572 1573 if (page == SES2_DIAGPAGE_THRESHOLD_IO) 1574 return (elem_setdef_threshold(np, page, data)); 1575 1576 SES_NV_CTLBOOL(props, SES_PROP_FAIL, uip->suci_rqst_fail); 1577 SES_NV_CTLBOOL(props, SES_PROP_IDENT, uip->suci_rqst_ident); 1578 1579 return (0); 1580} 1581 1582/*ARGSUSED*/ 1583static int 1584elem_setdef_display(ses_node_t *np, ses2_diag_page_t page, void *data) 1585{ 1586 ses2_display_ctl_impl_t *dip = data; 1587 nvlist_t *props = ses_node_props(np); 1588 1589 SES_NV_CTL64(props, SES_DPY_PROP_MODE, dip->sdci_display_mode); 1590 SES_NV_CTLBOOL(props, SES_PROP_FAIL, dip->sdci_rqst_fail); 1591 SES_NV_CTLBOOL(props, SES_PROP_IDENT, dip->sdci_rqst_ident); 1592 SES_NV_CTL16(props, SES_DPY_PROP_CHAR, 1593 dip->sdci_display_character); 1594 1595 return (0); 1596} 1597 1598/*ARGSUSED*/ 1599static int 1600elem_setdef_keypad(ses_node_t *np, ses2_diag_page_t page, void *data) 1601{ 1602 ses2_keypad_ctl_impl_t *kip = data; 1603 nvlist_t *props = ses_node_props(np); 1604 1605 SES_NV_CTLBOOL(props, SES_PROP_FAIL, kip->skci_rqst_fail); 1606 SES_NV_CTLBOOL(props, SES_PROP_IDENT, kip->skci_rqst_ident); 1607 1608 return (0); 1609} 1610 1611/*ARGSUSED*/ 1612static int 1613elem_setdef_px(ses_node_t *np, ses2_diag_page_t page, void *data) 1614{ 1615 ses2_port_ctl_impl_t *pip = data; 1616 nvlist_t *props = ses_node_props(np); 1617 1618 SES_NV_CTLBOOL(props, SES_PROP_FAIL, pip->spci_rqst_fail); 1619 SES_NV_CTLBOOL(props, SES_PROP_IDENT, pip->spci_rqst_ident); 1620 SES_NV_CTLBOOL(props, SES_PROP_DISABLED, pip->spci_disable); 1621 1622 return (0); 1623} 1624 1625/*ARGSUSED*/ 1626static int 1627elem_setdef_lang(ses_node_t *np, ses2_diag_page_t page, void *data) 1628{ 1629 ses2_lang_ctl_impl_t *lip = data; 1630 nvlist_t *props = ses_node_props(np); 1631 1632 SES_NV_CTLBOOL(props, SES_PROP_IDENT, lip->slci_rqst_ident); 1633 SES_NV_CTL16(props, SES_LANG_PROP_LANGCODE, 1634 lip->slci_language_code); 1635 1636 return (0); 1637} 1638 1639/*ARGSUSED*/ 1640static int 1641elem_setdef_comm(ses_node_t *np, ses2_diag_page_t page, void *data) 1642{ 1643 ses2_comm_ctl_impl_t *cip = data; 1644 nvlist_t *props = ses_node_props(np); 1645 1646 SES_NV_CTLBOOL(props, SES_PROP_FAIL, cip->scci_rqst_fail); 1647 SES_NV_CTLBOOL(props, SES_PROP_IDENT, cip->scci_rqst_ident); 1648 SES_NV_CTLBOOL(props, SES_PROP_DISABLED, cip->scci_disable); 1649 1650 return (0); 1651} 1652 1653static int 1654elem_setdef_voltage(ses_node_t *np, ses2_diag_page_t page, void *data) 1655{ 1656 ses2_voltage_ctl_impl_t *vip = data; 1657 nvlist_t *props = ses_node_props(np); 1658 1659 if (page == SES2_DIAGPAGE_THRESHOLD_IO) 1660 return (elem_setdef_threshold(np, page, data)); 1661 1662 SES_NV_CTLBOOL(props, SES_PROP_FAIL, vip->svci_rqst_fail); 1663 SES_NV_CTLBOOL(props, SES_PROP_IDENT, vip->svci_rqst_ident); 1664 1665 return (0); 1666} 1667 1668static int 1669elem_setdef_current(ses_node_t *np, ses2_diag_page_t page, void *data) 1670{ 1671 ses2_current_ctl_impl_t *cip = data; 1672 nvlist_t *props = ses_node_props(np); 1673 1674 if (page == SES2_DIAGPAGE_THRESHOLD_IO) 1675 return (elem_setdef_threshold(np, page, data)); 1676 1677 SES_NV_CTLBOOL(props, SES_PROP_FAIL, cip->scci_rqst_fail); 1678 SES_NV_CTLBOOL(props, SES_PROP_IDENT, cip->scci_rqst_ident); 1679 1680 return (0); 1681} 1682 1683/*ARGSUSED*/ 1684static int 1685elem_setdef_itp(ses_node_t *np, ses2_diag_page_t page, void *data) 1686{ 1687 ses2_itp_ctl_impl_t *iip = data; 1688 nvlist_t *props = ses_node_props(np); 1689 1690 SES_NV_CTLBOOL(props, SES_PROP_FAIL, iip->sici_rqst_fail); 1691 SES_NV_CTLBOOL(props, SES_PROP_IDENT, iip->sici_rqst_ident); 1692 SES_NV_CTLBOOL(props, SES_ITP_PROP_ENABLED, iip->sici_enable); 1693 1694 return (0); 1695} 1696 1697/*ARGSUSED*/ 1698static int 1699elem_setdef_sse(ses_node_t *np, ses2_diag_page_t page, void *data) 1700{ 1701 ses2_ss_ctl_impl_t *sip = data; 1702 nvlist_t *props = ses_node_props(np); 1703 1704 SES_NV_CTLBOOL(props, SES_PROP_FAIL, sip->ssci_rqst_fail); 1705 SES_NV_CTLBOOL(props, SES_PROP_IDENT, sip->ssci_rqst_ident); 1706 1707 return (0); 1708} 1709 1710/*ARGSUSED*/ 1711static int 1712elem_setdef_arraydev(ses_node_t *np, ses2_diag_page_t page, void *data) 1713{ 1714 ses2_array_device_ctl_impl_t *aip = data; 1715 nvlist_t *props = ses_node_props(np); 1716 1717 SES_NV_CTLBOOL(props, SES_AD_PROP_RR_ABORT, 1718 aip->sadci_rqst_rr_abort); 1719 SES_NV_CTLBOOL(props, SES_AD_PROP_REBUILD, 1720 aip->sadci_rqst_rebuild); 1721 SES_NV_CTLBOOL(props, SES_AD_PROP_IN_FAILED_ARRAY, 1722 aip->sadci_rqst_in_failed_array); 1723 SES_NV_CTLBOOL(props, SES_AD_PROP_IN_CRIT_ARRAY, 1724 aip->sadci_rqst_in_crit_array); 1725 SES_NV_CTLBOOL(props, SES_AD_PROP_CONS_CHK, 1726 aip->sadci_rqst_cons_check); 1727 SES_NV_CTLBOOL(props, SES_AD_PROP_HOT_SPARE, 1728 aip->sadci_rqst_hot_spare); 1729 SES_NV_CTLBOOL(props, SES_AD_PROP_RSVD_DEVICE, 1730 aip->sadci_rqst_rsvd_device); 1731 1732 SES_NV_CTLBOOL(props, SES_PROP_IDENT, aip->sadci_rqst_ident); 1733 SES_NV_CTLBOOL(props, SES_PROP_RMV, aip->sadci_rqst_remove); 1734 SES_NV_CTLBOOL(props, SES_DEV_PROP_READY_TO_INSERT, 1735 aip->sadci_rqst_insert); 1736 SES_NV_CTLBOOL(props, SES_DEV_PROP_REQ_MISSING, 1737 aip->sadci_rqst_missing); 1738 SES_NV_CTLBOOL(props, SES_DEV_PROP_DO_NOT_REMOVE, 1739 aip->sadci_do_not_remove); 1740 SES_NV_CTLBOOL(props, SES_DEV_PROP_REQ_ACTIVE, 1741 aip->sadci_rqst_active); 1742 1743 SES_NV_CTLBOOL(props, SES_DEV_PROP_BYP_B, aip->sadci_enable_byp_b); 1744 SES_NV_CTLBOOL(props, SES_DEV_PROP_BYP_A, aip->sadci_enable_byp_a); 1745 SES_NV_CTLBOOL(props, SES_PROP_OFF, aip->sadci_device_off); 1746 SES_NV_CTLBOOL(props, SES_DEV_PROP_FAULT_RQSTD, 1747 aip->sadci_rqst_fault); 1748 1749 return (0); 1750} 1751 1752/*ARGSUSED*/ 1753static int 1754elem_setdef_expander(ses_node_t *np, ses2_diag_page_t page, void *data) 1755{ 1756 ses2_expander_ctl_impl_t *eip = data; 1757 nvlist_t *props = ses_node_props(np); 1758 1759 SES_NV_CTLBOOL(props, SES_PROP_FAIL, eip->seci_rqst_fail); 1760 SES_NV_CTLBOOL(props, SES_PROP_IDENT, eip->seci_rqst_ident); 1761 1762 return (0); 1763} 1764 1765/*ARGSUSED*/ 1766static int 1767elem_setdef_sasconn(ses_node_t *np, ses2_diag_page_t page, void *data) 1768{ 1769 ses2_sasconn_ctl_impl_t *sip = data; 1770 nvlist_t *props = ses_node_props(np); 1771 1772 SES_NV_CTLBOOL(props, SES_PROP_IDENT, sip->ssci_rqst_ident); 1773 SES_NV_CTLBOOL(props, SES_PROP_FAIL, sip->ssci_rqst_fail); 1774 1775 return (0); 1776} 1777 1778#define CTL_DESC(_e, _n) \ 1779 { \ 1780 .scd_et = _e, \ 1781 .scd_props = _n##_props, \ 1782 .scd_setdef = elem_setdef_##_n \ 1783 } 1784 1785static const ses2_ctl_desc_t ctl_descs[] = { 1786 CTL_DESC(SES_ET_DEVICE, device), 1787 CTL_DESC(SES_ET_POWER_SUPPLY, psu), 1788 CTL_DESC(SES_ET_COOLING, cooling), 1789 CTL_DESC(SES_ET_TEMPERATURE_SENSOR, temp), 1790 CTL_DESC(SES_ET_DOOR_LOCK, lock), 1791 CTL_DESC(SES_ET_AUDIBLE_ALARM, alarm), 1792 CTL_DESC(SES_ET_ESC_ELECTRONICS, esc), 1793 CTL_DESC(SES_ET_SCC_ELECTRONICS, scc), 1794 CTL_DESC(SES_ET_NONVOLATILE_CACHE, cache), 1795 CTL_DESC(SES_ET_UPS, ups), 1796 CTL_DESC(SES_ET_DISPLAY, display), 1797 CTL_DESC(SES_ET_KEY_PAD_ENTRY, keypad), 1798 CTL_DESC(SES_ET_SCSI_PORT_XCVR, px), 1799 CTL_DESC(SES_ET_LANGUAGE, lang), 1800 CTL_DESC(SES_ET_COMMUNICATION_PORT, comm), 1801 CTL_DESC(SES_ET_VOLTAGE_SENSOR, voltage), 1802 CTL_DESC(SES_ET_CURRENT_SENSOR, current), 1803 CTL_DESC(SES_ET_SCSI_TARGET_PORT, itp), 1804 CTL_DESC(SES_ET_SCSI_INITIATOR_PORT, itp), 1805 CTL_DESC(SES_ET_SIMPLE_SUBENCLOSURE, sse), 1806 CTL_DESC(SES_ET_ARRAY_DEVICE, arraydev), 1807 CTL_DESC(SES_ET_SAS_EXPANDER, expander), 1808 CTL_DESC(SES_ET_SAS_CONNECTOR, sasconn), 1809 { .scd_et = -1 } 1810}; 1811 1812int 1813ses2_element_ctl(ses_plugin_t *sp, ses_node_t *np, const char *op, 1814 nvlist_t *nvl) 1815{ 1816 const ses2_ctl_desc_t *dp; 1817 nvlist_t *props = ses_node_props(np); 1818 uint64_t type; 1819 1820 if (strcmp(op, SES_CTL_OP_SETPROP) != 0) 1821 return (0); 1822 1823 VERIFY(nvlist_lookup_uint64(props, SES_PROP_ELEMENT_TYPE, 1824 &type) == 0); 1825 1826 for (dp = &ctl_descs[0]; dp->scd_et != -1; dp++) 1827 if (dp->scd_et == type) 1828 break; 1829 1830 if (dp->scd_et == -1) 1831 return (0); 1832 1833 return (ses2_setprop(sp, np, dp->scd_props, nvl)); 1834} 1835 1836int 1837ses2_element_setdef(ses_node_t *np, ses2_diag_page_t page, void *data) 1838{ 1839 const ses2_ctl_desc_t *dp; 1840 nvlist_t *props = ses_node_props(np); 1841 uint64_t type; 1842 1843 VERIFY(nvlist_lookup_uint64(props, SES_PROP_ELEMENT_TYPE, &type) == 0); 1844 1845 for (dp = &ctl_descs[0]; dp->scd_et != -1; dp++) 1846 if (dp->scd_et == type) 1847 break; 1848 1849 if (dp->scd_et == -1) 1850 return (0); 1851 1852 if (dp->scd_setdef(np, page, data) != 0) 1853 return (-1); 1854 1855 return (0); 1856} 1857