2N/A/*
2N/A * CDDL HEADER START
2N/A *
2N/A * The contents of this file are subject to the terms of the
2N/A * Common Development and Distribution License (the "License").
2N/A * You may not use this file except in compliance with the License.
2N/A *
2N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A * or http://www.opensolaris.org/os/licensing.
2N/A * See the License for the specific language governing permissions
2N/A * and limitations under the License.
2N/A *
2N/A * When distributing Covered Code, include this CDDL HEADER in each
2N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A * If applicable, add the following below this CDDL HEADER, with the
2N/A * fields enclosed by brackets "[]" replaced with your own identifying
2N/A * information: Portions Copyright [yyyy] [name of copyright owner]
2N/A *
2N/A * CDDL HEADER END
2N/A */
2N/A
2N/A/*
2N/A * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
2N/A * Use is subject to license terms.
2N/A */
2N/A
2N/A/*
2N/A * Sun4v Platform specific functions.
2N/A *
2N/A * called when :
2N/A * machine_type == StPaul
2N/A *
2N/A */
2N/A
2N/A#pragma ident "%Z%%M% %I% %E% SMI"
2N/A
2N/A#include <stdio.h>
2N/A#include <stdlib.h>
2N/A#include <unistd.h>
2N/A#include <kstat.h>
2N/A#include <fcntl.h>
2N/A#include <string.h>
2N/A#include <assert.h>
2N/A#include <libintl.h>
2N/A#include <note.h>
2N/A#include <sys/systeminfo.h>
2N/A#include <sys/openpromio.h>
2N/A#include <sys/sysmacros.h>
2N/A#include <picl.h>
2N/A#include "picldefs.h"
2N/A#include <pdevinfo.h>
2N/A#include <display.h>
2N/A#include <display_sun4v.h>
2N/A#include <libprtdiag.h>
2N/A#include "stpaul.h"
2N/A
2N/A/* prototypes for local functions */
2N/Astatic void get_bus_type(char *path, struct io_card *card);
2N/Astatic void get_slot_number(char *path, struct io_card *card);
2N/Astatic int stpaul_get_network_instance(char *path);
2N/Astatic int stpaul_get_usb_instance(char *path);
2N/Astatic int stpaul_get_io_instance(char *path, char *type);
2N/Astatic int stpaul_get_first_compatible_value(picl_nodehdl_t nodeh,
2N/A char **outbuf);
2N/Astatic int64_t stpaul_get_int_propval(picl_nodehdl_t modh, char *prop_name,
2N/A int *ret);
2N/A
2N/A/* ARGSUSED */
2N/Aint
2N/Astpaul_pci_callback(picl_nodehdl_t pcih, void *args)
2N/A{
2N/A int err = PICL_SUCCESS;
2N/A picl_nodehdl_t nodeh;
2N/A char path[MAXSTRLEN];
2N/A char parent_path[MAXSTRLEN];
2N/A char piclclass[PICL_CLASSNAMELEN_MAX];
2N/A char name[MAXSTRLEN];
2N/A char model[MAXSTRLEN];
2N/A char *compatible;
2N/A char binding_name[MAXSTRLEN];
2N/A struct io_card pci_card;
2N/A int32_t instance;
2N/A char pn_type;
2N/A
2N/A err = picl_get_propval_by_name(pcih, PICL_PROP_DEVFS_PATH, parent_path,
2N/A sizeof (parent_path));
2N/A if (err != PICL_SUCCESS)
2N/A return (err);
2N/A
2N/A /* Walk through the children */
2N/A
2N/A err = picl_get_propval_by_name(pcih, PICL_PROP_CHILD, &nodeh,
2N/A sizeof (picl_nodehdl_t));
2N/A
2N/A while (err == PICL_SUCCESS) {
2N/A err = picl_get_propval_by_name(nodeh, PICL_PROP_CLASSNAME,
2N/A piclclass, sizeof (piclclass));
2N/A if (err != PICL_SUCCESS)
2N/A return (err);
2N/A
2N/A if (strcmp(piclclass, PICL_CLASS_PCIEX) == 0) {
2N/A err = picl_get_propval_by_name(nodeh, PICL_PROP_PEER,
2N/A &nodeh, sizeof (picl_nodehdl_t));
2N/A continue;
2N/A }
2N/A
2N/A if (strcmp(piclclass, PICL_CLASS_PCI) == 0) {
2N/A err = picl_get_propval_by_name(nodeh, PICL_PROP_CHILD,
2N/A &nodeh, sizeof (picl_nodehdl_t));
2N/A continue;
2N/A }
2N/A
2N/A err = picl_get_propval_by_name(nodeh, PICL_PROP_DEVFS_PATH,
2N/A path, sizeof (path));
2N/A if (err != PICL_SUCCESS)
2N/A return (err);
2N/A
2N/A (void) strlcpy(pci_card.notes, path, sizeof (pci_card.notes));
2N/A
2N/A get_bus_type(path, &pci_card);
2N/A
2N/A get_slot_number(path, &pci_card);
2N/A
2N/A err = picl_get_propval_by_name(nodeh, PICL_PROP_NAME, &name,
2N/A sizeof (name));
2N/A if (err == PICL_PROPNOTFOUND)
2N/A (void) strlcpy(name, "", sizeof (name));
2N/A else if (err != PICL_SUCCESS)
2N/A return (err);
2N/A
2N/A /* Figure NAC name */
2N/A if ((strcmp(name, NETWORK) == 0) &&
2N/A (strcmp(pci_card.slot_str, MOTHERBOARD) == 0)) {
2N/A instance = stpaul_get_network_instance(path);
2N/A (void) snprintf(pci_card.status,
2N/A sizeof (pci_card.status), "%s/%s%d",
2N/A MOTHERBOARD, "NET", instance);
2N/A
2N/A
2N/A } else if ((strcmp(name, SCSI) == 0) &&
2N/A (strcmp(pci_card.slot_str, MOTHERBOARD) == 0)) {
2N/A (void) snprintf(pci_card.status,
2N/A sizeof (pci_card.status), "%s/%s",
2N/A MOTHERBOARD, SPL_SCSI_TAG);
2N/A
2N/A } else {
2N/A if (pci_card.slot != -1) {
2N/A (void) snprintf(pci_card.status,
2N/A sizeof (pci_card.status), "%s/%s%d",
2N/A MOTHERBOARD, pci_card.bus_type,
2N/A pci_card.slot);
2N/A } else {
2N/A (void) snprintf(pci_card.status,
2N/A sizeof (pci_card.status), "%s/%s",
2N/A MOTHERBOARD, pci_card.bus_type);
2N/A }
2N/A }
2N/A
2N/A /* Special case for USB */
2N/A if (strncmp(name, USB, strlen(USB)) == 0) {
2N/A instance = stpaul_get_usb_instance(path);
2N/A if (instance != -1)
2N/A (void) snprintf(pci_card.status,
2N/A sizeof (pci_card.status), "%s/%s%d",
2N/A MOTHERBOARD, "USB", instance);
2N/A }
2N/A
2N/A /* PEM/NEM case is handled here */
2N/A if ((instance = stpaul_get_io_instance(path, &pn_type)) != -1) {
2N/A if (pn_type == SPL_PEM_TYPE)
2N/A (void) snprintf(pci_card.status,
2N/A sizeof (pci_card.status), "%s/%s%d",
2N/A MOTHERBOARD, "PCI-EM", instance);
2N/A else if (pn_type == SPL_NEM_TYPE)
2N/A (void) snprintf(pci_card.status,
2N/A sizeof (pci_card.status), "%s/%s%d",
2N/A MOTHERBOARD, "NEM", instance);
2N/A }
2N/A /*
2N/A * Get the name of this card. If binding_name is found,
2N/A * name will be <nodename>-<binding_name>
2N/A */
2N/A
2N/A err = picl_get_propval_by_name(nodeh, PICL_PROP_BINDING_NAME,
2N/A &binding_name, sizeof (binding_name));
2N/A if (err == PICL_PROPNOTFOUND) {
2N/A /*
2N/A * if compatible prop is found, name will be
2N/A * <nodename>-<compatible>
2N/A */
2N/A err = stpaul_get_first_compatible_value(nodeh,
2N/A &compatible);
2N/A if (err == PICL_SUCCESS) {
2N/A (void) strlcat(name, "-", MAXSTRLEN);
2N/A (void) strlcat(name, compatible, MAXSTRLEN);
2N/A free(compatible);
2N/A } else if (err != PICL_PROPNOTFOUND)
2N/A return (err);
2N/A } else if (err != PICL_SUCCESS)
2N/A return (err);
2N/A else if (strcmp(name, binding_name) != 0) {
2N/A (void) strlcat(name, "-", MAXSTRLEN);
2N/A (void) strlcat(name, binding_name, MAXSTRLEN);
2N/A }
2N/A
2N/A (void) strlcpy(pci_card.name, name, sizeof (pci_card.name));
2N/A
2N/A /* Get the model of this card */
2N/A
2N/A err = picl_get_propval_by_name(nodeh, OBP_PROP_MODEL,
2N/A &model, sizeof (model));
2N/A if (err == PICL_PROPNOTFOUND)
2N/A (void) strlcpy(model, "", sizeof (model));
2N/A else if (err != PICL_SUCCESS)
2N/A return (err);
2N/A (void) strlcpy(pci_card.model, model, sizeof (pci_card.model));
2N/A
2N/A /* Print NAC name */
2N/A log_printf("%-11s", pci_card.status);
2N/A /* Print IO Type */
2N/A log_printf("%6s", pci_card.bus_type);
2N/A /* Print Slot # */
2N/A log_printf("%5s", pci_card.slot_str);
2N/A /* Print Parent Path */
2N/A log_printf("%46.45s", pci_card.notes);
2N/A /* Printf Card Name */
2N/A if (strlen(pci_card.name) > 24)
2N/A log_printf("%25.24s+", pci_card.name);
2N/A else
2N/A log_printf("%26s", pci_card.name);
2N/A /* Print Card Model */
2N/A if (strlen(pci_card.model) > 10)
2N/A log_printf("%10.9s+", pci_card.model);
2N/A else
2N/A log_printf("%10s", pci_card.model);
2N/A log_printf("\n");
2N/A
2N/A err = picl_get_propval_by_name(nodeh, PICL_PROP_PEER, &nodeh,
2N/A sizeof (picl_nodehdl_t));
2N/A
2N/A }
2N/A
2N/A return (PICL_WALK_CONTINUE);
2N/A}
2N/A
2N/A/* ARGSUSED */
2N/Aint
2N/Astpaul_hw_rev_callback(picl_nodehdl_t pcih, void *args)
2N/A{
2N/A int err = PICL_SUCCESS;
2N/A char path[MAXSTRLEN];
2N/A char device_path[MAXSTRLEN];
2N/A char NAC[MAXSTRLEN];
2N/A char *compatible;
2N/A int32_t revision;
2N/A int device_found = 0;
2N/A char name[MAXSTRLEN];
2N/A picl_nodehdl_t nodeh;
2N/A
2N/A err = picl_get_propval_by_name(pcih, PICL_PROP_DEVFS_PATH, path,
2N/A sizeof (path));
2N/A if (err != PICL_SUCCESS)
2N/A return (err);
2N/A
2N/A /* usb is special as a child of PCIE2PCI bridge */
2N/A if (strcmp(path, SPL_PCIE2PCI) == 0) {
2N/A err = picl_get_propval_by_name(pcih, PICL_PROP_CHILD, &nodeh,
2N/A sizeof (picl_nodehdl_t));
2N/A if (err != PICL_SUCCESS)
2N/A return (err);
2N/A err = picl_get_propval_by_name(nodeh, PICL_PROP_NAME, &name,
2N/A sizeof (name));
2N/A if (err != PICL_SUCCESS)
2N/A return (err);
2N/A if (strcmp(name, USB) == 0) {
2N/A err = stpaul_hw_rev_callback(nodeh, &nodeh);
2N/A if (err != PICL_SUCCESS)
2N/A return (err);
2N/A }
2N/A }
2N/A
2N/A if ((strcmp(path, SPL_NETWORK_0_PATH) == 0) ||
2N/A (strcmp(path, SPL_NETWORK_1_PATH) == 0)) {
2N/A device_found = 1;
2N/A (void) snprintf(NAC, sizeof (NAC), "%s/%s%d", MOTHERBOARD,
2N/A OPHIR, 0);
2N/A revision = stpaul_get_int_propval(pcih, OBP_PROP_REVISION_ID,
2N/A &err);
2N/A }
2N/A
2N/A if ((strcmp(path, SPL_USB0_PATH) == 0) ||
2N/A (strcmp(path, SPL_USB1_PATH) == 0) ||
2N/A (strcmp(path, SPL_USB2_PATH) == 0)) {
2N/A device_found = 1;
2N/A (void) snprintf(NAC, sizeof (NAC), "%s/%s%d", MOTHERBOARD,
2N/A USB_TAG, 0);
2N/A revision = stpaul_get_int_propval(pcih, OBP_PROP_REVISION_ID,
2N/A &err);
2N/A }
2N/A
2N/A if ((strcmp(path, FIRE_PATH0) == 0) ||
2N/A (strcmp(path, FIRE_PATH1) == 0)) {
2N/A device_found = 1;
2N/A (void) snprintf(NAC, sizeof (NAC), "%s/%s", MOTHERBOARD,
2N/A "IO-BRIDGE");
2N/A revision = stpaul_get_int_propval(pcih, OBP_PROP_VERSION_NUM,
2N/A &err);
2N/A }
2N/A
2N/A if (strcmp(path, SWITCH_A_PATH) == 0) {
2N/A device_found = 1;
2N/A (void) snprintf(NAC, sizeof (NAC), "%s/%s", MOTHERBOARD,
2N/A SWITCH_A);
2N/A revision = stpaul_get_int_propval(pcih, OBP_PROP_REVISION_ID,
2N/A &err);
2N/A }
2N/A
2N/A if (strcmp(path, SWITCH_B_PATH) == 0) {
2N/A device_found = 1;
2N/A (void) snprintf(NAC, sizeof (NAC), "%s/%s", MOTHERBOARD,
2N/A SWITCH_B);
2N/A revision = stpaul_get_int_propval(pcih, OBP_PROP_REVISION_ID,
2N/A &err);
2N/A }
2N/A
2N/A if (strcmp(path, SPL_LSI_PATH) == 0) {
2N/A device_found = 1;
2N/A (void) snprintf(NAC, sizeof (NAC), "%s/%s", MOTHERBOARD,
2N/A SPL_SAS_HBA);
2N/A revision = stpaul_get_int_propval(pcih, OBP_PROP_REVISION_ID,
2N/A &err);
2N/A }
2N/A
2N/A if (strcmp(path, SPL_PCIE2PCI) == 0) {
2N/A device_found = 1;
2N/A (void) snprintf(NAC, sizeof (NAC), "%s/%s", MOTHERBOARD,
2N/A PCI_BRIDGE);
2N/A revision = stpaul_get_int_propval(pcih, OBP_PROP_REVISION_ID,
2N/A &err);
2N/A }
2N/A
2N/A if (device_found == 1) {
2N/A
2N/A (void) strlcpy(device_path, path, sizeof (device_path));
2N/A err = stpaul_get_first_compatible_value(pcih, &compatible);
2N/A
2N/A /* Print NAC name */
2N/A log_printf("%-20s", NAC);
2N/A /* Print Device Path */
2N/A if (strlen(device_path) > 38)
2N/A log_printf("%38.37s+", device_path);
2N/A else
2N/A log_printf("%39s", device_path);
2N/A /* Print Compatible # */
2N/A if (err == PICL_SUCCESS) {
2N/A log_printf("%31s", compatible);
2N/A free(compatible);
2N/A } else
2N/A log_printf("%31s", " ");
2N/A /* Print Revision */
2N/A log_printf("%6d", revision);
2N/A log_printf("\n");
2N/A }
2N/A
2N/A return (PICL_WALK_CONTINUE);
2N/A}
2N/A
2N/Astatic void
2N/Aget_bus_type(char *path, struct io_card *card)
2N/A{
2N/A if (strncmp(path, SPL_PCIE_PEM0, strlen(SPL_PCIE_PEM0)) == 0) {
2N/A (void) strlcpy(card->bus_type, "PCIE", sizeof (card->bus_type));
2N/A } else if (strncmp(path, SPL_PCIE_PEM1, strlen(SPL_PCIE_PEM1)) == 0) {
2N/A (void) strlcpy(card->bus_type, "PCIE", sizeof (card->bus_type));
2N/A } else if (strncmp(path, SPL_PCIE_NEM0, strlen(SPL_PCIE_NEM0)) == 0) {
2N/A (void) strlcpy(card->bus_type, "PCIE", sizeof (card->bus_type));
2N/A } else if (strncmp(path, SPL_PCIE_NEM1, strlen(SPL_PCIE_NEM1)) == 0) {
2N/A (void) strlcpy(card->bus_type, "PCIE", sizeof (card->bus_type));
2N/A } else if (strncmp(path, SWITCH_A_PATH, strlen(SWITCH_A_PATH)) == 0) {
2N/A (void) strlcpy(card->bus_type, "PCIE", sizeof (card->bus_type));
2N/A } else if (strncmp(path, SWITCH_B_PATH, strlen(SWITCH_B_PATH)) == 0) {
2N/A (void) strlcpy(card->bus_type, "PCIE", sizeof (card->bus_type));
2N/A } else {
2N/A (void) strlcpy(card->bus_type, "NONE", sizeof (card->bus_type));
2N/A }
2N/A}
2N/A
2N/Astatic void
2N/Aget_slot_number(char *path, struct io_card *card)
2N/A{
2N/A if (strncmp(path, SPL_PCIE_PEM0, strlen(SPL_PCIE_PEM0)) == 0) {
2N/A (void) strlcpy(card->slot_str, "0", sizeof (card->slot_str));
2N/A card->slot = 0;
2N/A } else if (strncmp(path, SPL_PCIE_NEM0, strlen(SPL_PCIE_NEM0)) == 0) {
2N/A (void) strlcpy(card->slot_str, "0", sizeof (card->slot_str));
2N/A card->slot = 0;
2N/A } else if (strncmp(path, SPL_PCIE_PEM1, strlen(SPL_PCIE_PEM1)) == 0) {
2N/A (void) strlcpy(card->slot_str, "1", sizeof (card->slot_str));
2N/A card->slot = 1;
2N/A } else if (strncmp(path, SPL_PCIE_NEM1, strlen(SPL_PCIE_NEM1)) == 0) {
2N/A (void) strlcpy(card->slot_str, "1", sizeof (card->slot_str));
2N/A card->slot = 1;
2N/A } else {
2N/A (void) strlcpy(card->slot_str, MOTHERBOARD,
2N/A sizeof (card->slot_str));
2N/A card->slot = -1;
2N/A }
2N/A}
2N/A
2N/Astatic int
2N/Astpaul_get_network_instance(char *path)
2N/A{
2N/A if (strncmp(path, SPL_NETWORK_1_PATH,
2N/A strlen(SPL_NETWORK_1_PATH)) == 0)
2N/A return (1);
2N/A else if (strncmp(path, SPL_NETWORK_0_PATH,
2N/A strlen(SPL_NETWORK_0_PATH)) == 0)
2N/A return (0);
2N/A else
2N/A return (-1);
2N/A}
2N/A
2N/Astatic int
2N/Astpaul_get_usb_instance(char *path)
2N/A{
2N/A if (strncmp(path, SPL_USB2_PATH, strlen(SPL_USB2_PATH)) == 0)
2N/A return (2);
2N/A else if (strncmp(path, SPL_USB1_PATH, strlen(SPL_USB1_PATH)) == 0)
2N/A return (1);
2N/A else if (strncmp(path, SPL_USB0_PATH, strlen(path)) == 0)
2N/A return (0);
2N/A else
2N/A return (-1);
2N/A}
2N/A
2N/Astatic int
2N/Astpaul_get_io_instance(char *path, char *type)
2N/A{
2N/A if (strncmp(path, SPL_PCIE_PEM1, strlen(SPL_PCIE_PEM1)) == 0) {
2N/A *type = SPL_PEM_TYPE;
2N/A return (1);
2N/A } else if (strncmp(path, SPL_PCIE_PEM0, strlen(SPL_PCIE_PEM0)) == 0) {
2N/A *type = SPL_PEM_TYPE;
2N/A return (0);
2N/A } else if (strncmp(path, SPL_PCIE_NEM1, strlen(SPL_PCIE_NEM1)) == 0) {
2N/A *type = SPL_NEM_TYPE;
2N/A return (1);
2N/A } else if (strncmp(path, SPL_PCIE_NEM0, strlen(SPL_PCIE_NEM0)) == 0) {
2N/A *type = SPL_NEM_TYPE;
2N/A return (0);
2N/A } else
2N/A return (-1);
2N/A}
2N/A/*
2N/A * return the first compatible value
2N/A */
2N/Astatic int
2N/Astpaul_get_first_compatible_value(picl_nodehdl_t nodeh, char **outbuf)
2N/A{
2N/A int err;
2N/A picl_prophdl_t proph;
2N/A picl_propinfo_t pinfo;
2N/A picl_prophdl_t tblh;
2N/A picl_prophdl_t rowproph;
2N/A char *pval;
2N/A
2N/A err = picl_get_propinfo_by_name(nodeh, OBP_PROP_COMPATIBLE,
2N/A &pinfo, &proph);
2N/A if (err != PICL_SUCCESS)
2N/A return (err);
2N/A
2N/A if (pinfo.type == PICL_PTYPE_CHARSTRING) {
2N/A pval = malloc(pinfo.size);
2N/A if (pval == NULL)
2N/A return (PICL_FAILURE);
2N/A err = picl_get_propval(proph, pval, pinfo.size);
2N/A if (err != PICL_SUCCESS) {
2N/A free(pval);
2N/A return (err);
2N/A }
2N/A *outbuf = pval;
2N/A return (PICL_SUCCESS);
2N/A }
2N/A
2N/A if (pinfo.type != PICL_PTYPE_TABLE)
2N/A return (PICL_FAILURE);
2N/A
2N/A /* get first string from table */
2N/A err = picl_get_propval(proph, &tblh, pinfo.size);
2N/A if (err != PICL_SUCCESS)
2N/A return (err);
2N/A
2N/A err = picl_get_next_by_row(tblh, &rowproph);
2N/A if (err != PICL_SUCCESS)
2N/A return (err);
2N/A
2N/A err = picl_get_propinfo(rowproph, &pinfo);
2N/A if (err != PICL_SUCCESS)
2N/A return (err);
2N/A
2N/A pval = malloc(pinfo.size);
2N/A if (pval == NULL)
2N/A return (PICL_FAILURE);
2N/A
2N/A err = picl_get_propval(rowproph, pval, pinfo.size);
2N/A if (err != PICL_SUCCESS) {
2N/A free(pval);
2N/A return (err);
2N/A }
2N/A
2N/A *outbuf = pval;
2N/A return (PICL_SUCCESS);
2N/A}
2N/A
2N/Astatic int64_t
2N/Astpaul_get_int_propval(picl_nodehdl_t modh, char *prop_name, int *ret)
2N/A{
2N/A int err;
2N/A picl_prophdl_t proph;
2N/A picl_propinfo_t pinfo;
2N/A int8_t int8v;
2N/A int16_t int16v;
2N/A int32_t int32v;
2N/A int64_t int64v;
2N/A
2N/A err = picl_get_propinfo_by_name(modh, prop_name, &pinfo, &proph);
2N/A if (err != PICL_SUCCESS) {
2N/A *ret = err;
2N/A return (0);
2N/A }
2N/A
2N/A /*
2N/A * If it is not an int, uint or byte array prop, return failure
2N/A */
2N/A if ((pinfo.type != PICL_PTYPE_INT) &&
2N/A (pinfo.type != PICL_PTYPE_UNSIGNED_INT) &&
2N/A (pinfo.type != PICL_PTYPE_BYTEARRAY)) {
2N/A *ret = PICL_FAILURE;
2N/A return (0);
2N/A }
2N/A
2N/A switch (pinfo.size) {
2N/A case sizeof (int8_t):
2N/A err = picl_get_propval(proph, &int8v, sizeof (int8v));
2N/A *ret = err;
2N/A return (int8v);
2N/A case sizeof (int16_t):
2N/A err = picl_get_propval(proph, &int16v, sizeof (int16v));
2N/A *ret = err;
2N/A return (int16v);
2N/A case sizeof (int32_t):
2N/A err = picl_get_propval(proph, &int32v, sizeof (int32v));
2N/A *ret = err;
2N/A return (int32v);
2N/A case sizeof (int64_t):
2N/A err = picl_get_propval(proph, &int64v, sizeof (int64v));
2N/A *ret = err;
2N/A return (int64v);
2N/A default: /* not supported size */
2N/A *ret = PICL_FAILURE;
2N/A return (0);
2N/A }
2N/A}