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 2006 Sun Microsystems, Inc. All rights reserved. 23 * Use is subject to license terms. 24 */ 25 26 /* 27 * Sun4v Platform specific functions. 28 * 29 * called when : 30 * machine_type == ontario 31 * 32 */ 33 34 #pragma ident "%Z%%M% %I% %E% SMI" 35 36 #include <stdio.h> 37 #include <stdlib.h> 38 #include <unistd.h> 39 #include <kstat.h> 40 #include <fcntl.h> 41 #include <string.h> 42 #include <assert.h> 43 #include <libintl.h> 44 #include <note.h> 45 #include <sys/systeminfo.h> 46 #include <sys/openpromio.h> 47 #include <sys/sysmacros.h> 48 #include <picl.h> 49 #include "picldefs.h" 50 #include <pdevinfo.h> 51 #include <display.h> 52 #include <display_sun4v.h> 53 #include <libprtdiag.h> 54 #include "ontario.h" 55 #include "erie.h" 56 #include "pelton.h" 57 #include "stpaul.h" 58 59 #if !defined(TEXT_DOMAIN) 60 #define TEXT_DOMAIN "SYS_TEST" 61 #endif 62 63 /* 64 * these functions will overlay the symbol table of libprtdiag 65 * at runtime 66 */ 67 void sun4v_display_pci(picl_nodehdl_t plafh); 68 void sun4v_display_diaginfo(int flag, Prom_node *root, picl_nodehdl_t plafh); 69 70 71 /* local functions */ 72 static void sun4v_display_hw_revisions(Prom_node *root, picl_nodehdl_t plafh); 73 static int ontario_pci_callback(picl_nodehdl_t pcih, void *args); 74 static int ontario_get_first_compatible_value(picl_nodehdl_t nodeh, 75 char **outbuf); 76 static int64_t ontario_get_int_propval(picl_nodehdl_t modh, char *prop_name, 77 int *ret); 78 79 static void 80 get_bus_type(char *path, struct io_card *card) 81 { 82 if (strncmp(path, PCIX_SLOT0, PCIX_COMP_NUM) == 0) { 83 (void) strcpy(card->bus_type, "PCIX"); 84 } else { 85 (void) strcpy(card->bus_type, "PCIE"); 86 } 87 } 88 89 static void 90 get_slot_number(char *path, struct io_card *card) 91 { 92 if (strncmp(path, PCIE_SLOT0, PCIE_COMP_NUM) == 0) { 93 (void) strcpy(card->slot_str, "0"); 94 card->slot = 0; 95 } else if (strncmp(path, PCIE_SLOT1, PCIE_COMP_NUM) == 0) { 96 (void) strcpy(card->slot_str, "1"); 97 card->slot = 1; 98 } else if (strncmp(path, PCIE_SLOT2, PCIE_COMP_NUM) == 0) { 99 (void) strcpy(card->slot_str, "2"); 100 card->slot = 2; 101 } else if (strncmp(path, PCIX_SLOT1, strlen(PCIX_SLOT1)) == 0) { 102 (void) strcpy(card->slot_str, "PCIX"); 103 card->slot = -1; 104 } else if (strncmp(path, PCIX_SLOT0, strlen(PCIX_SLOT0)) == 0) { 105 (void) strcpy(card->slot_str, "PCIX"); 106 card->slot = -1; 107 } else { 108 (void) strcpy(card->slot_str, IOBOARD); 109 card->slot = -1; 110 } 111 } 112 113 static int 114 ontario_get_network_instance(char *path) 115 { 116 if (strncmp(path, NETWORK_1_PATH, strlen(NETWORK_1_PATH)) == 0) { 117 return (1); 118 } else if (strncmp(path, NETWORK_3_PATH, strlen(NETWORK_3_PATH)) == 0) { 119 return (3); 120 } else if (strncmp(path, NETWORK_0_PATH, strlen(NETWORK_0_PATH)) == 0) { 121 return (0); 122 } else if (strncmp(path, NETWORK_2_PATH, strlen(NETWORK_2_PATH)) == 0) { 123 return (2); 124 } else { 125 return (-1); 126 } 127 } 128 /* 129 * add all io devices under pci in io list 130 */ 131 /* ARGSUSED */ 132 static int 133 ontario_pci_callback(picl_nodehdl_t pcih, void *args) 134 { 135 int err = PICL_SUCCESS; 136 picl_nodehdl_t nodeh; 137 char path[MAXSTRLEN]; 138 char parent_path[MAXSTRLEN]; 139 char piclclass[PICL_CLASSNAMELEN_MAX]; 140 char name[MAXSTRLEN]; 141 char model[MAXSTRLEN]; 142 char *compatible; 143 char binding_name[MAXSTRLEN]; 144 struct io_card pci_card; 145 int32_t instance; 146 147 err = picl_get_propval_by_name(pcih, PICL_PROP_DEVFS_PATH, parent_path, 148 sizeof (parent_path)); 149 if (err != PICL_SUCCESS) { 150 return (err); 151 } 152 153 /* Walk through the children */ 154 155 err = picl_get_propval_by_name(pcih, PICL_PROP_CHILD, &nodeh, 156 sizeof (picl_nodehdl_t)); 157 158 while (err == PICL_SUCCESS) { 159 err = picl_get_propval_by_name(nodeh, PICL_PROP_CLASSNAME, 160 piclclass, sizeof (piclclass)); 161 if (err != PICL_SUCCESS) 162 return (err); 163 164 if (strcmp(piclclass, "pciex") == 0) { 165 err = picl_get_propval_by_name(nodeh, PICL_PROP_PEER, 166 &nodeh, sizeof (picl_nodehdl_t)); 167 continue; 168 } 169 170 if (strcmp(piclclass, PICL_CLASS_PCI) == 0) { 171 err = picl_get_propval_by_name(nodeh, PICL_PROP_CHILD, 172 &nodeh, sizeof (picl_nodehdl_t)); 173 continue; 174 } 175 176 err = picl_get_propval_by_name(nodeh, PICL_PROP_DEVFS_PATH, 177 path, sizeof (path)); 178 if (err != PICL_SUCCESS) { 179 return (err); 180 } 181 182 (void) strlcpy(pci_card.notes, path, sizeof (pci_card.notes)); 183 184 get_bus_type(parent_path, &pci_card); 185 186 get_slot_number(parent_path, &pci_card); 187 188 err = picl_get_propval_by_name(nodeh, PICL_PROP_NAME, &name, 189 sizeof (name)); 190 if (err == PICL_PROPNOTFOUND) 191 (void) strcpy(name, ""); 192 else if (err != PICL_SUCCESS) 193 return (err); 194 195 /* Figure NAC name */ 196 if ((strcmp(name, NETWORK) == 0) && 197 (strcmp(pci_card.slot_str, IOBOARD) == 0)) { 198 instance = ontario_get_network_instance(path); 199 200 (void) snprintf(pci_card.status, 201 sizeof (pci_card.status), "%s/%s%d", IOBOARD, 202 "NET", instance); 203 } else { 204 if (pci_card.slot != -1) { 205 (void) snprintf(pci_card.status, 206 sizeof (pci_card.status), "%s/%s%d", 207 IOBOARD, pci_card.bus_type, pci_card.slot); 208 } else { 209 (void) snprintf(pci_card.status, 210 sizeof (pci_card.status), "%s/%s", IOBOARD, 211 pci_card.bus_type); 212 } 213 } 214 215 /* 216 * Get the name of this card. If binding_name is found, 217 * name will be <nodename>-<binding_name> 218 */ 219 220 err = picl_get_propval_by_name(nodeh, PICL_PROP_BINDING_NAME, 221 &binding_name, sizeof (binding_name)); 222 if (err == PICL_PROPNOTFOUND) { 223 /* 224 * if compatible prop is found, name will be 225 * <nodename>-<compatible> 226 */ 227 err = ontario_get_first_compatible_value(nodeh, 228 &compatible); 229 if (err == PICL_SUCCESS) { 230 (void) strlcat(name, "-", MAXSTRLEN); 231 (void) strlcat(name, compatible, MAXSTRLEN); 232 free(compatible); 233 } else if (err != PICL_PROPNOTFOUND) { 234 return (err); 235 } 236 } else if (err != PICL_SUCCESS) { 237 return (err); 238 } else if (strcmp(name, binding_name) != 0) { 239 (void) strlcat(name, "-", MAXSTRLEN); 240 (void) strlcat(name, binding_name, MAXSTRLEN); 241 } 242 243 (void) strlcpy(pci_card.name, name, sizeof (pci_card.name)); 244 245 /* Get the model of this card */ 246 247 err = picl_get_propval_by_name(nodeh, OBP_PROP_MODEL, 248 &model, sizeof (model)); 249 if (err == PICL_PROPNOTFOUND) 250 (void) strcpy(model, ""); 251 else if (err != PICL_SUCCESS) 252 return (err); 253 (void) strlcpy(pci_card.model, model, sizeof (pci_card.model)); 254 255 /* Print NAC name */ 256 log_printf("%-11s", pci_card.status); 257 /* Print IO Type */ 258 log_printf("%6s", pci_card.bus_type); 259 /* Print Slot # */ 260 log_printf("%5s", pci_card.slot_str); 261 /* Print Parent Path */ 262 log_printf("%46.45s", pci_card.notes); 263 /* Printf Card Name */ 264 if (strlen(pci_card.name) > 24) 265 log_printf("%25.24s+", pci_card.name); 266 else 267 log_printf("%26s", pci_card.name); 268 /* Print Card Model */ 269 if (strlen(pci_card.model) > 10) 270 log_printf("%10.9s+", pci_card.model); 271 else 272 log_printf("%10s", pci_card.model); 273 log_printf("\n"); 274 275 err = picl_get_propval_by_name(nodeh, PICL_PROP_PEER, &nodeh, 276 sizeof (picl_nodehdl_t)); 277 278 } 279 280 return (PICL_WALK_CONTINUE); 281 } 282 /* 283 * display_pci 284 * Display all the PCI IO cards on this board. 285 */ 286 void 287 sun4v_display_pci(picl_nodehdl_t plafh) 288 { 289 char platbuf[MAXSTRLEN]; 290 char *fmt = "%-11s %-5s %-4s %-45s %-25s %-8s"; 291 static int banner = FALSE; /* Have we printed the column headings? */ 292 293 if (banner == FALSE) { 294 log_printf("\n", 0); 295 log_printf("=========================", 0); 296 log_printf(dgettext(TEXT_DOMAIN, " IO Configuration "), 0); 297 log_printf("=========================", 0); 298 log_printf("\n", 0); 299 log_printf("\n", 0); 300 log_printf(fmt, "", "IO", "", "", "", "", 0); 301 log_printf("\n", 0); 302 log_printf(fmt, "Location", "Type", "Slot", "Path", 303 "Name", "Model", 0); 304 log_printf("\n"); 305 log_printf(fmt, "-----------", "-----", "----", 306 "---------------------------------------------", 307 "-------------------------", "---------", 0); 308 log_printf("\n"); 309 banner = TRUE; 310 } 311 312 /* Get platform name, if that fails, use ontario name by default */ 313 if (sysinfo(SI_PLATFORM, platbuf, sizeof (platbuf)) == -1) { 314 (void) strcpy(platbuf, ONTARIO_PLATFORM); 315 } 316 317 /* 318 * Call functions based on appropriate platform 319 */ 320 if ((strncmp(platbuf, ONTARIO_PLATFORM, 321 strlen(ONTARIO_PLATFORM)) == 0) || 322 (strncmp(platbuf, ONTARIO_PLATFORM2, 323 strlen(ONTARIO_PLATFORM2)) == 0)) { 324 (void) picl_walk_tree_by_class(plafh, "pciex", 325 "pciex", ontario_pci_callback); 326 } else if ((strncmp(platbuf, PELTON_PLATFORM, 327 strlen(PELTON_PLATFORM))) == 0) { 328 (void) picl_walk_tree_by_class(plafh, "pciex", 329 "pciex", pelton_pci_callback); 330 } else if ((strncmp(platbuf, STPAUL_PLATFORM, 331 strlen(STPAUL_PLATFORM))) == 0) { 332 (void) picl_walk_tree_by_class(plafh, "pciex", 333 "pciex", stpaul_pci_callback); 334 } else { 335 (void) picl_walk_tree_by_class(plafh, "pciex", "pciex", 336 erie_pci_callback); 337 (void) picl_walk_tree_by_class(plafh, "pci", "pci", 338 erie_pci_callback); 339 } 340 } 341 342 /* 343 * ---------------------------------------------------------------------------- 344 */ 345 346 /* ARGSUSED */ 347 void 348 sun4v_display_diaginfo(int flag, Prom_node *root, picl_nodehdl_t plafh) 349 { 350 /* NOTE(ARGUNUSED(kstats)) */ 351 /* 352 * Now display the last powerfail time and the fatal hardware 353 * reset information. We do this under a couple of conditions. 354 * First if the user asks for it. The second is if the user 355 * told us to do logging, and we found a system failure. 356 */ 357 if (flag) { 358 /* 359 * display time of latest powerfail. Not all systems 360 * have this capability. For those that do not, this 361 * is just a no-op. 362 */ 363 disp_powerfail(root); 364 365 /* platform_disp_prom_version(tree); */ 366 sun4v_display_hw_revisions(root, plafh); 367 } 368 } 369 370 /* 371 * local functions 372 */ 373 /* 374 * add all io devices under pci in io list 375 */ 376 /* ARGSUSED */ 377 static int 378 ontario_hw_rev_callback(picl_nodehdl_t pcih, void *args) 379 { 380 int err = PICL_SUCCESS; 381 char path[MAXSTRLEN] = ""; 382 char device_path[MAXSTRLEN]; 383 char NAC[MAXSTRLEN]; 384 char *compatible; 385 int32_t revision; 386 int device_found; 387 388 device_found = 0; 389 390 err = picl_get_propval_by_name(pcih, PICL_PROP_DEVFS_PATH, path, 391 sizeof (path)); 392 if (err != PICL_SUCCESS) { 393 return (err); 394 } 395 396 if ((strcmp(path, NETWORK_0_PATH) == 0) || 397 (strcmp(path, NETWORK_1_PATH) == 0)) { 398 device_found = 1; 399 (void) snprintf(NAC, sizeof (NAC), "%s/%s%d", IOBOARD, OPHIR, 400 0); 401 revision = ontario_get_int_propval(pcih, OBP_PROP_REVISION_ID, 402 &err); 403 } 404 405 if ((strcmp(path, NETWORK_2_PATH) == 0) || 406 (strcmp(path, NETWORK_3_PATH) == 0)) { 407 device_found = 1; 408 (void) snprintf(NAC, sizeof (NAC), "%s/%s%d", IOBOARD, OPHIR, 409 1); 410 revision = ontario_get_int_propval(pcih, OBP_PROP_REVISION_ID, 411 &err); 412 } 413 414 if ((strcmp(path, FIRE_PATH0) == 0) || 415 (strcmp(path, FIRE_PATH1) == 0)) { 416 device_found = 1; 417 (void) snprintf(NAC, sizeof (NAC), "%s/%s", IOBOARD, 418 "IO-BRIDGE"); 419 revision = ontario_get_int_propval(pcih, OBP_PROP_VERSION_NUM, 420 &err); 421 } 422 423 if ((strcmp(path, PCIX_SLOT0) == 0) || 424 (strcmp(path, PCIX_SLOT1) == 0)) { 425 device_found = 1; 426 (void) snprintf(NAC, sizeof (NAC), "%s/%s", IOBOARD, 427 PCI_BRIDGE); 428 revision = ontario_get_int_propval(pcih, OBP_PROP_REVISION_ID, 429 &err); 430 } 431 432 if (strcmp(path, SWITCH_A_PATH) == 0) { 433 device_found = 1; 434 (void) snprintf(NAC, sizeof (NAC), "%s/%s", IOBOARD, SWITCH_A); 435 revision = ontario_get_int_propval(pcih, OBP_PROP_REVISION_ID, 436 &err); 437 } 438 439 if (strcmp(path, SWITCH_B_PATH) == 0) { 440 device_found = 1; 441 (void) snprintf(NAC, sizeof (NAC), "%s/%s", IOBOARD, SWITCH_B); 442 revision = ontario_get_int_propval(pcih, OBP_PROP_REVISION_ID, 443 &err); 444 } 445 446 if (strcmp(path, ONT_LSI_PATH) == 0) { 447 device_found = 1; 448 (void) snprintf(NAC, sizeof (NAC), "%s/%s", IOBOARD, 449 SAS_SATA_HBA); 450 revision = ontario_get_int_propval(pcih, OBP_PROP_REVISION_ID, 451 &err); 452 } 453 if (device_found == 1) { 454 (void) strcpy(device_path, path); 455 err = ontario_get_first_compatible_value(pcih, &compatible); 456 457 /* Print NAC name */ 458 log_printf("%-20s", NAC); 459 /* Print Device Path */ 460 if (strlen(device_path) > 38) 461 log_printf("%38.37s+", device_path); 462 else 463 log_printf("%39s", device_path); 464 /* Print Compatible # */ 465 log_printf("%31s", compatible); 466 free(compatible); 467 /* Print Revision */ 468 log_printf("%6d", revision); 469 log_printf("\n"); 470 } 471 472 return (PICL_WALK_CONTINUE); 473 } 474 475 /*ARGSUSED*/ 476 static void 477 sun4v_display_hw_revisions(Prom_node *root, picl_nodehdl_t plafh) 478 { 479 Prom_node *pnode; 480 char *value; 481 char platbuf[MAXSTRLEN]; 482 char *fmt = "%-20s %-40s %-30s %-9s"; 483 484 log_printf(dgettext(TEXT_DOMAIN, "\n" 485 "========================= HW Revisions " 486 "=======================================\n\n")); 487 488 log_printf(dgettext(TEXT_DOMAIN, 489 "System PROM revisions:\n" 490 "----------------------\n")); 491 492 pnode = dev_find_node(root, "openprom"); 493 if (pnode != NULL) { 494 value = (char *)get_prop_val(find_prop(pnode, "version")); 495 log_printf(value); 496 } 497 498 log_printf(dgettext(TEXT_DOMAIN, "\n\n" 499 "IO ASIC revisions:\n" 500 "------------------\n")); 501 log_printf(fmt, "Location", "Path", "Device", "Revision\n", 0); 502 log_printf(fmt, "--------------------", 503 "----------------------------------------", 504 "------------------------------", 505 "---------\n", 0); 506 507 /* Get platform name, if that fails, use ontario name by default */ 508 if (sysinfo(SI_PLATFORM, platbuf, sizeof (platbuf)) == -1) { 509 (void) strcpy(platbuf, ONTARIO_PLATFORM); 510 } 511 512 /* 513 * Walk tree based on platform 514 */ 515 if ((strncmp(platbuf, ONTARIO_PLATFORM, 516 strlen(ONTARIO_PLATFORM))) == 0) { 517 (void) picl_walk_tree_by_class(plafh, "pciex", 518 "pciex", ontario_hw_rev_callback); 519 (void) picl_walk_tree_by_class(plafh, "pci", 520 "pci", ontario_hw_rev_callback); 521 (void) picl_walk_tree_by_class(plafh, "network", 522 "network", ontario_hw_rev_callback); 523 (void) picl_walk_tree_by_class(plafh, "scsi-2", "scsi-2", 524 ontario_hw_rev_callback); 525 } else if ((strncmp(platbuf, PELTON_PLATFORM, 526 strlen(PELTON_PLATFORM))) == 0) { 527 (void) picl_walk_tree_by_class(plafh, "pciex", 528 "pciex", pelton_hw_rev_callback); 529 (void) picl_walk_tree_by_class(plafh, "pci", 530 "pci", pelton_hw_rev_callback); 531 (void) picl_walk_tree_by_class(plafh, "network", 532 "network", pelton_hw_rev_callback); 533 (void) picl_walk_tree_by_class(plafh, "scsi-2", "scsi-2", 534 pelton_hw_rev_callback); 535 } else if ((strncmp(platbuf, STPAUL_PLATFORM, 536 strlen(STPAUL_PLATFORM))) == 0) { 537 (void) picl_walk_tree_by_class(plafh, "pciex", 538 "pciex", stpaul_hw_rev_callback); 539 (void) picl_walk_tree_by_class(plafh, "pci", 540 "pci", stpaul_hw_rev_callback); 541 (void) picl_walk_tree_by_class(plafh, "network", 542 "network", stpaul_hw_rev_callback); 543 (void) picl_walk_tree_by_class(plafh, "scsi-2", "scsi-2", 544 stpaul_hw_rev_callback); 545 } else { 546 (void) picl_walk_tree_by_class(plafh, "pciex", "pciex", 547 erie_hw_rev_callback); 548 (void) picl_walk_tree_by_class(plafh, "pci", "pci", 549 erie_hw_rev_callback); 550 (void) picl_walk_tree_by_class(plafh, "network", "network", 551 erie_hw_rev_callback); 552 (void) picl_walk_tree_by_class(plafh, "scsi-2", "scsi-2", 553 erie_hw_rev_callback); 554 } 555 } 556 557 /* 558 * return the first compatible value 559 */ 560 static int 561 ontario_get_first_compatible_value(picl_nodehdl_t nodeh, char **outbuf) 562 { 563 int err; 564 picl_prophdl_t proph; 565 picl_propinfo_t pinfo; 566 picl_prophdl_t tblh; 567 picl_prophdl_t rowproph; 568 char *pval; 569 570 err = picl_get_propinfo_by_name(nodeh, OBP_PROP_COMPATIBLE, 571 &pinfo, &proph); 572 if (err != PICL_SUCCESS) 573 return (err); 574 575 if (pinfo.type == PICL_PTYPE_CHARSTRING) { 576 pval = malloc(pinfo.size); 577 if (pval == NULL) 578 return (PICL_FAILURE); 579 err = picl_get_propval(proph, pval, pinfo.size); 580 if (err != PICL_SUCCESS) { 581 free(pval); 582 return (err); 583 } 584 *outbuf = pval; 585 return (PICL_SUCCESS); 586 } 587 588 if (pinfo.type != PICL_PTYPE_TABLE) 589 return (PICL_FAILURE); 590 591 /* get first string from table */ 592 err = picl_get_propval(proph, &tblh, pinfo.size); 593 if (err != PICL_SUCCESS) 594 return (err); 595 596 err = picl_get_next_by_row(tblh, &rowproph); 597 if (err != PICL_SUCCESS) 598 return (err); 599 600 err = picl_get_propinfo(rowproph, &pinfo); 601 if (err != PICL_SUCCESS) 602 return (err); 603 604 pval = malloc(pinfo.size); 605 if (pval == NULL) 606 return (PICL_FAILURE); 607 608 err = picl_get_propval(rowproph, pval, pinfo.size); 609 if (err != PICL_SUCCESS) { 610 free(pval); 611 return (err); 612 } 613 614 *outbuf = pval; 615 return (PICL_SUCCESS); 616 } 617 618 static int64_t 619 ontario_get_int_propval(picl_nodehdl_t modh, char *prop_name, int *ret) 620 { 621 int err; 622 picl_prophdl_t proph; 623 picl_propinfo_t pinfo; 624 int8_t int8v; 625 int16_t int16v; 626 int32_t int32v; 627 int64_t int64v; 628 629 err = picl_get_propinfo_by_name(modh, prop_name, &pinfo, &proph); 630 if (err != PICL_SUCCESS) { 631 *ret = err; 632 return (0); 633 } 634 635 /* 636 * If it is not an int, uint or byte array prop, return failure 637 */ 638 if ((pinfo.type != PICL_PTYPE_INT) && 639 (pinfo.type != PICL_PTYPE_UNSIGNED_INT) && 640 (pinfo.type != PICL_PTYPE_BYTEARRAY)) { 641 *ret = PICL_FAILURE; 642 return (0); 643 } 644 645 switch (pinfo.size) { 646 case sizeof (int8_t): 647 err = picl_get_propval(proph, &int8v, sizeof (int8v)); 648 *ret = err; 649 return (int8v); 650 case sizeof (int16_t): 651 err = picl_get_propval(proph, &int16v, sizeof (int16v)); 652 *ret = err; 653 return (int16v); 654 case sizeof (int32_t): 655 err = picl_get_propval(proph, &int32v, sizeof (int32v)); 656 *ret = err; 657 return (int32v); 658 case sizeof (int64_t): 659 err = picl_get_propval(proph, &int64v, sizeof (int64v)); 660 *ret = err; 661 return (int64v); 662 default: /* not supported size */ 663 *ret = PICL_FAILURE; 664 return (0); 665 } 666 } 667