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 * See the License for the specific language governing permissions 2N/A * and limitations under the License. 2N/A * When distributing Covered Code, include this CDDL HEADER in each 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 * Copyright 2010 Sun Microsystems, Inc. All rights reserved. 2N/A * Use is subject to license terms. 2N/A DBG(
"ioctl(%d SBD_CMD_GETNCM, 0x%p)\n", a->
fd, (
void *)
ctl);
2N/A /* Open the file descriptor if not already open */ 2N/A * The status target is the board. If we need to 2N/A * return component data (to support the -a option), 2N/A * get the number of components on the board. 2N/A * The status structure contains space for one component; 2N/A * add the space for the other components if necessary. 2N/A * The target is a specific component. Pass its 2N/A * name and unit number to the driver. Set its 2N/A * type to UNKNOWN since the plugin does not know 2N/A * the type of the component specified by the user. 2N/A DBG(
"ioctl(%d SBD_CMD_STATUS, sc=0x%p sz=%d flags=%d",
2N/A * Convert a component to a target type. 2N/A * Ideally, for board operations (other than status) it is not 2N/A * necessary to issue the STATUS ioctl. The call however allows a 2N/A * final sanity check to ensure that the board number returned 2N/A * by the driver matches the plugin's notion of the board number 2N/A * as extracted from the ap_id. If this check is not desirable, 2N/A * we can change the code to issue the status call only when 2N/A * necessary. Note that for component operations, we need to do 2N/A * the STATUS in order to figure out the component type and 2N/A * Set the component count to the returned stat count. 2N/A * Initialize the RCM module here so that it can record 2N/A * the initial state of the capacity information. 2N/A DBG(
"ds_name,ds_unit,ds_type=<%s,%d,%d> ",
2N/A * Consider the names matched if they are either 2N/A * both absent or the same. It is conceivable that 2N/A * a NULL component name be considered valid 2N/A * Initialize the RCM module here so that it can record 2N/A * the initial state of the capacity information. 2N/A * The type field is defined to be parsable by cfgadm(1M): It 2N/A * must not contain white space characters. This function 2N/A * converts white space to underscore. 2N/A DBG(
"ap_init bd=%d rs=%d os=%d type=<%s>\n",
2N/A * See if the a quiesce operation is required for 2N/A * this command for any of the components. If the 2N/A * command does not map to an ioctl, then there is 2N/A * See if any component requires a 2N/A * OS suspension for this command. 2N/A * If there are no platform options set then there 2N/A * is no need to check this operation 2N/A * Check if any of the steps in the sequence 2N/A * allows for a platform option 2N/A * If the platopt is set it means that the platform does not 2N/A * support options for this cmd 2N/A * If this is a passthru command, pass all of its 2N/A * options; otherwise, pass all options after the 2N/A * Only pass the platform option to the cmds that the platform 2N/A * has specified as ok 2N/A * Return the error string corresponding to a given error code. 2N/A * String table and error code sets are provided by sbd_etab. This data 2N/A * structure is automatically generated at compile time from the error 2N/A * Found it. Just extract the string 2N/A * The driver sets the errno to EIO if it returns 2N/A * more detailed error info via e_code. In all 2N/A * other cases, use standard error text. 2N/A * cfgadm -o err=plugin-err,cmd=name,code=ecode -x errtest ap_id. 2N/A "\tcfgadm [-o parsable] -l ap_id\n",
2N/A "\tcfgadm [-o unassign|nopoweroff] -c disconnect ap_id\n",
2N/A "\tcfgadm -t ap_id\n",
2N/A "\tcfgadm -x assign ap_id\n",
2N/A "\tcfgadm -x unassign ap_id\n",
2N/A "\tcfgadm -x poweron ap_id\n",
2N/A "\tcfgadm -x poweroff ap_id\n",
2N/A * If no component sequence number is provided 2N/A * default to the current target component. 2N/A * Assume an io component so that we can get 2N/A * the path if the component is indeed of type io. 2N/A * If the component has a unit number, 2N/A * add it to the id, otherwise just use 2N/A * the component's name. 2N/A * Convert a component to a target type. 2N/A DBG(
"ap_cm_init bd=%d rs=%d os=%d type=<%s> seq=%d\n",
2N/A ", ecache %d MBytes" 2N/A ", %lu KBytes total",
2N/A ", %lu KBytes permanent",
2N/A ", memory delete requested on %s",
2N/A ", memory delete in progress on %s",
2N/A ", %lu KBytes deleted",
2N/A ", %lu KBytes remaining",
2N/A ", inter board interleave" 2N/A " inter-board-interleave" 2N/A * This function assumes pagesize > 1024 and that 2N/A * pagesize is a multiple of 1024. 2N/A * If there is a valid peer physical ap_id specified, 2N/A * convert it to a logical id. 2N/A * Save the component portion of the physid and 2N/A * add it back after converting to logical format. 2N/A /* attempt to resolve to symlink */ 2N/A ", ecache %d MBytes" 2N/A /* Print the first cpuid */ 2N/A * Print the middle cpuids, if necessary. Stop before 2N/A * the last one, since printing the last cpuid is a 2N/A * special case for the non parsable form. 2N/A /* Print the last cpuid, if necessary */