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 2009 Sun Microsystems, Inc. All rights reserved. 2N/A * Use is subject to license terms. 2N/A * finding the appropriate communication transport & device path for a 2N/A * given service. This supports the transition from the legacy service channel 2N/A * transport (glvc) to the logical domain channel (vldc) transport native 2N/A * to platforms running Logical Domains (LDoms). 2N/A * The mechanism to relate a service to a device path is different for 2N/A * vldc and glvc, due to the way the device pathnames are encoded: 2N/A * Sample service: sunvts 2N/A * Service Name: SUNW,sun4v-sunvts 2N/A * As VLDC is the communication mechanism used in an LDoms environment, it is 2N/A * the preferred channel, and its existence is checked for first. 2N/A * Extract from dev_path the "service name" portion. 2N/A * For vldc, the service corresponds to the minor name of the device path 2N/A * (e.g. virtual-channel@3:sunvts for sunvts). If service is non-NULL, it must 2N/A * match the extracted service name for the function to succeed. 2N/A * The service name is returned in match (if non-NULL), and the function 2N/A * itself returns true on success; false on failure. 2N/A * If in addition, a service string is specified to 2N/A * be matched, do a comparison 2N/A * Extract from dev_path the "service name" portion. 2N/A * For glvc, the service corresponds to the node name of the device path 2N/A * (e.g. sunvts@a:glvc for sunvts). If service is non-NULL, it must 2N/A * match the extracted service name for the function to succeed. 2N/A * The service name is returned in match (if non-NULL), and the function 2N/A * itself returns true on success; false on failure. 2N/A * If a service string is specified, check if there 2N/A * This routine accepts either a prefixed service name or a legacy full 2N/A * pathname (which might not even exist in the filesystem), and in either case 2N/A * returns a canonical service name. If the parameter is neither a service 2N/A * name (i.e. with a "SUNW,sun4v-" prefix), nor a path to a legacy glvc or 2N/A * vldc device, NULL is returned. 2N/A * First check whether a service name 2N/A * Not a service name, check if it's a valid pathname 2N/A * Ideally, we should only check for a valid glvc pathname, 2N/A * requiring all vldc access to be only via service names. But 2N/A * to prevent a flag day with code that's already passing in 2N/A * vldc full pathnames (e.g. sunMC), we allow them here. 2N/A * Walk all "service" device nodes to find the one with the 2N/A * matching glvc minor name 2N/A /* Ensure that the 'glvc' driver is loaded */ 2N/A /* Make sure node name matches service name */ 2N/A /* Walk minor nodes */ 2N/A * Walk all vldc device nodes to find the one with the 2N/A * matching minor name 2N/A /* Ensure that the 'vldc' driver is loaded */ 2N/A /* Walk minor nodes */ 2N/A * Given a service name or a full legacy pathname, return 2N/A * the full pathname to the appropriate vldc or glvc device. 2N/A * First lookup vldc nodes 2N/A * If no vldc, try to find a glvc node