xref: /titanic_44/usr/src/cmd/devfsadm/cfg_link.c (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
24*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
28*7c478bd9Sstevel@tonic-gate 
29*7c478bd9Sstevel@tonic-gate #include <devfsadm.h>
30*7c478bd9Sstevel@tonic-gate #include <stdio.h>
31*7c478bd9Sstevel@tonic-gate #include <strings.h>
32*7c478bd9Sstevel@tonic-gate #include <stdlib.h>
33*7c478bd9Sstevel@tonic-gate #include <limits.h>
34*7c478bd9Sstevel@tonic-gate 
35*7c478bd9Sstevel@tonic-gate #define	SCSI_CFG_LINK_RE	"^cfg/c[0-9]+$"
36*7c478bd9Sstevel@tonic-gate #define	SBD_CFG_LINK_RE		"^cfg/((((N[0-9]+[.])?(SB|IB))?[0-9]+)|[abcd])$"
37*7c478bd9Sstevel@tonic-gate #define	USB_CFG_LINK_RE		"^cfg/((usb[0-9]+)/([0-9]+)([.]([0-9])+)*)$"
38*7c478bd9Sstevel@tonic-gate #define	PCI_CFG_LINK_RE		"^cfg/[:alnum:]$"
39*7c478bd9Sstevel@tonic-gate #define	IB_CFG_LINK_RE		"^cfg/(hca[0-9A-F]+)$"
40*7c478bd9Sstevel@tonic-gate 
41*7c478bd9Sstevel@tonic-gate #define	CFG_DIRNAME		"cfg"
42*7c478bd9Sstevel@tonic-gate 
43*7c478bd9Sstevel@tonic-gate static int	scsi_cfg_creat_cb(di_minor_t minor, di_node_t node);
44*7c478bd9Sstevel@tonic-gate static int	sbd_cfg_creat_cb(di_minor_t minor, di_node_t node);
45*7c478bd9Sstevel@tonic-gate static int	usb_cfg_creat_cb(di_minor_t minor, di_node_t node);
46*7c478bd9Sstevel@tonic-gate static char	*get_roothub(const char *path, void *cb_arg);
47*7c478bd9Sstevel@tonic-gate static int	pci_cfg_creat_cb(di_minor_t minor, di_node_t node);
48*7c478bd9Sstevel@tonic-gate static int	ib_cfg_creat_cb(di_minor_t minor, di_node_t node);
49*7c478bd9Sstevel@tonic-gate 
50*7c478bd9Sstevel@tonic-gate /*
51*7c478bd9Sstevel@tonic-gate  * NOTE: The CREATE_DEFER flag is private to this module.
52*7c478bd9Sstevel@tonic-gate  *	 NOT to be used by other modules
53*7c478bd9Sstevel@tonic-gate  */
54*7c478bd9Sstevel@tonic-gate static devfsadm_create_t cfg_create_cbt[] = {
55*7c478bd9Sstevel@tonic-gate 	{ "attachment-point", "ddi_ctl:attachment_point:scsi", NULL,
56*7c478bd9Sstevel@tonic-gate 	    TYPE_EXACT | CREATE_DEFER, ILEVEL_0, scsi_cfg_creat_cb
57*7c478bd9Sstevel@tonic-gate 	},
58*7c478bd9Sstevel@tonic-gate 	{ "attachment-point", "ddi_ctl:attachment_point:sbd", NULL,
59*7c478bd9Sstevel@tonic-gate 	    TYPE_EXACT, ILEVEL_0, sbd_cfg_creat_cb
60*7c478bd9Sstevel@tonic-gate 	},
61*7c478bd9Sstevel@tonic-gate 	{ "fc-attachment-point", "ddi_ctl:attachment_point:fc", NULL,
62*7c478bd9Sstevel@tonic-gate 	    TYPE_EXACT | CREATE_DEFER, ILEVEL_0, scsi_cfg_creat_cb
63*7c478bd9Sstevel@tonic-gate 	},
64*7c478bd9Sstevel@tonic-gate 	{ "attachment-point", "ddi_ctl:attachment_point:usb", NULL,
65*7c478bd9Sstevel@tonic-gate 	    TYPE_EXACT, ILEVEL_0, usb_cfg_creat_cb
66*7c478bd9Sstevel@tonic-gate 	},
67*7c478bd9Sstevel@tonic-gate 	{ "attachment-point", "ddi_ctl:attachment_point:pci", NULL,
68*7c478bd9Sstevel@tonic-gate 	    TYPE_EXACT, ILEVEL_0, pci_cfg_creat_cb
69*7c478bd9Sstevel@tonic-gate 	},
70*7c478bd9Sstevel@tonic-gate 	{ "attachment-point", "ddi_ctl:attachment_point:ib", NULL,
71*7c478bd9Sstevel@tonic-gate 	    TYPE_EXACT, ILEVEL_0, ib_cfg_creat_cb
72*7c478bd9Sstevel@tonic-gate 	}
73*7c478bd9Sstevel@tonic-gate };
74*7c478bd9Sstevel@tonic-gate 
75*7c478bd9Sstevel@tonic-gate DEVFSADM_CREATE_INIT_V0(cfg_create_cbt);
76*7c478bd9Sstevel@tonic-gate 
77*7c478bd9Sstevel@tonic-gate static devfsadm_remove_t cfg_remove_cbt[] = {
78*7c478bd9Sstevel@tonic-gate 	{ "attachment-point", SCSI_CFG_LINK_RE, RM_POST,
79*7c478bd9Sstevel@tonic-gate 	    ILEVEL_0, devfsadm_rm_all
80*7c478bd9Sstevel@tonic-gate 	},
81*7c478bd9Sstevel@tonic-gate 	{ "attachment-point", SBD_CFG_LINK_RE, RM_POST,
82*7c478bd9Sstevel@tonic-gate 	    ILEVEL_0, devfsadm_rm_all
83*7c478bd9Sstevel@tonic-gate 	},
84*7c478bd9Sstevel@tonic-gate 	{ "fc-attachment-point", SCSI_CFG_LINK_RE, RM_POST,
85*7c478bd9Sstevel@tonic-gate 	    ILEVEL_0, devfsadm_rm_all
86*7c478bd9Sstevel@tonic-gate 	},
87*7c478bd9Sstevel@tonic-gate 	{ "attachment-point", USB_CFG_LINK_RE, RM_POST|RM_HOT|RM_ALWAYS,
88*7c478bd9Sstevel@tonic-gate 	    ILEVEL_0, devfsadm_rm_all
89*7c478bd9Sstevel@tonic-gate 	},
90*7c478bd9Sstevel@tonic-gate 	{ "attachment-point", PCI_CFG_LINK_RE, RM_POST,
91*7c478bd9Sstevel@tonic-gate 	    ILEVEL_0, devfsadm_rm_all
92*7c478bd9Sstevel@tonic-gate 	},
93*7c478bd9Sstevel@tonic-gate 	{ "attachment-point", IB_CFG_LINK_RE, RM_POST|RM_HOT|RM_ALWAYS,
94*7c478bd9Sstevel@tonic-gate 	    ILEVEL_0, devfsadm_rm_all
95*7c478bd9Sstevel@tonic-gate 	}
96*7c478bd9Sstevel@tonic-gate };
97*7c478bd9Sstevel@tonic-gate 
98*7c478bd9Sstevel@tonic-gate DEVFSADM_REMOVE_INIT_V0(cfg_remove_cbt);
99*7c478bd9Sstevel@tonic-gate 
100*7c478bd9Sstevel@tonic-gate static int
101*7c478bd9Sstevel@tonic-gate scsi_cfg_creat_cb(di_minor_t minor, di_node_t node)
102*7c478bd9Sstevel@tonic-gate {
103*7c478bd9Sstevel@tonic-gate 	char path[PATH_MAX + 1];
104*7c478bd9Sstevel@tonic-gate 	char *c_num = NULL, *devfs_path, *mn;
105*7c478bd9Sstevel@tonic-gate 	devfsadm_enumerate_t rules[3] = {
106*7c478bd9Sstevel@tonic-gate 	    {"^r?dsk$/^c([0-9]+)", 1, MATCH_PARENT},
107*7c478bd9Sstevel@tonic-gate 	    {"^cfg$/^c([0-9]+)$", 1, MATCH_ADDR},
108*7c478bd9Sstevel@tonic-gate 	    {"^scsi$/^.+$/^c([0-9]+)", 1, MATCH_PARENT}
109*7c478bd9Sstevel@tonic-gate 	};
110*7c478bd9Sstevel@tonic-gate 
111*7c478bd9Sstevel@tonic-gate 	mn = di_minor_name(minor);
112*7c478bd9Sstevel@tonic-gate 
113*7c478bd9Sstevel@tonic-gate 	if ((devfs_path = di_devfs_path(node)) == NULL) {
114*7c478bd9Sstevel@tonic-gate 		return (DEVFSADM_CONTINUE);
115*7c478bd9Sstevel@tonic-gate 	}
116*7c478bd9Sstevel@tonic-gate 	(void) strcpy(path, devfs_path);
117*7c478bd9Sstevel@tonic-gate 	(void) strcat(path, ":");
118*7c478bd9Sstevel@tonic-gate 	(void) strcat(path, mn);
119*7c478bd9Sstevel@tonic-gate 	di_devfs_path_free(devfs_path);
120*7c478bd9Sstevel@tonic-gate 
121*7c478bd9Sstevel@tonic-gate 	if (devfsadm_enumerate_int(path, 1, &c_num, rules, 3)
122*7c478bd9Sstevel@tonic-gate 	    == DEVFSADM_FAILURE) {
123*7c478bd9Sstevel@tonic-gate 		/*
124*7c478bd9Sstevel@tonic-gate 		 * Unlike the disks module we don't retry on failure.
125*7c478bd9Sstevel@tonic-gate 		 * If we have multiple "c" numbers for a single physical
126*7c478bd9Sstevel@tonic-gate 		 * controller due to bug 4045879, we will not assign a
127*7c478bd9Sstevel@tonic-gate 		 * c-number/symlink for the controller.
128*7c478bd9Sstevel@tonic-gate 		 */
129*7c478bd9Sstevel@tonic-gate 		return (DEVFSADM_CONTINUE);
130*7c478bd9Sstevel@tonic-gate 	}
131*7c478bd9Sstevel@tonic-gate 
132*7c478bd9Sstevel@tonic-gate 	(void) strcpy(path, CFG_DIRNAME);
133*7c478bd9Sstevel@tonic-gate 	(void) strcat(path, "/c");
134*7c478bd9Sstevel@tonic-gate 	(void) strcat(path, c_num);
135*7c478bd9Sstevel@tonic-gate 
136*7c478bd9Sstevel@tonic-gate 	free(c_num);
137*7c478bd9Sstevel@tonic-gate 
138*7c478bd9Sstevel@tonic-gate 	(void) devfsadm_mklink(path, node, minor, 0);
139*7c478bd9Sstevel@tonic-gate 
140*7c478bd9Sstevel@tonic-gate 	return (DEVFSADM_CONTINUE);
141*7c478bd9Sstevel@tonic-gate }
142*7c478bd9Sstevel@tonic-gate 
143*7c478bd9Sstevel@tonic-gate static int
144*7c478bd9Sstevel@tonic-gate sbd_cfg_creat_cb(di_minor_t minor, di_node_t node)
145*7c478bd9Sstevel@tonic-gate {
146*7c478bd9Sstevel@tonic-gate 	char path[PATH_MAX + 1];
147*7c478bd9Sstevel@tonic-gate 
148*7c478bd9Sstevel@tonic-gate 	(void) strcpy(path, CFG_DIRNAME);
149*7c478bd9Sstevel@tonic-gate 	(void) strcat(path, "/");
150*7c478bd9Sstevel@tonic-gate 	(void) strcat(path, di_minor_name(minor));
151*7c478bd9Sstevel@tonic-gate 	(void) devfsadm_mklink(path, node, minor, 0);
152*7c478bd9Sstevel@tonic-gate 	return (DEVFSADM_CONTINUE);
153*7c478bd9Sstevel@tonic-gate }
154*7c478bd9Sstevel@tonic-gate 
155*7c478bd9Sstevel@tonic-gate 
156*7c478bd9Sstevel@tonic-gate static int
157*7c478bd9Sstevel@tonic-gate usb_cfg_creat_cb(di_minor_t minor, di_node_t node)
158*7c478bd9Sstevel@tonic-gate {
159*7c478bd9Sstevel@tonic-gate 	char *cp, path[PATH_MAX + 1];
160*7c478bd9Sstevel@tonic-gate 	devfsadm_enumerate_t rules[1] =
161*7c478bd9Sstevel@tonic-gate 		{"^cfg$/^usb([0-9]+)$", 1, MATCH_CALLBACK, NULL, get_roothub};
162*7c478bd9Sstevel@tonic-gate 
163*7c478bd9Sstevel@tonic-gate 	if ((cp = di_devfs_path(node)) == NULL) {
164*7c478bd9Sstevel@tonic-gate 		return (DEVFSADM_CONTINUE);
165*7c478bd9Sstevel@tonic-gate 	}
166*7c478bd9Sstevel@tonic-gate 
167*7c478bd9Sstevel@tonic-gate 	(void) snprintf(path, sizeof (path), "%s:%s", cp, di_minor_name(minor));
168*7c478bd9Sstevel@tonic-gate 	di_devfs_path_free(cp);
169*7c478bd9Sstevel@tonic-gate 
170*7c478bd9Sstevel@tonic-gate 	if (devfsadm_enumerate_int(path, 0, &cp, rules, 1)) {
171*7c478bd9Sstevel@tonic-gate 		return (DEVFSADM_CONTINUE);
172*7c478bd9Sstevel@tonic-gate 	}
173*7c478bd9Sstevel@tonic-gate 
174*7c478bd9Sstevel@tonic-gate 	/* create usbN and the symlink */
175*7c478bd9Sstevel@tonic-gate 	(void) snprintf(path, sizeof (path), "%s/usb%s/%s", CFG_DIRNAME, cp,
176*7c478bd9Sstevel@tonic-gate 	    di_minor_name(minor));
177*7c478bd9Sstevel@tonic-gate 	free(cp);
178*7c478bd9Sstevel@tonic-gate 
179*7c478bd9Sstevel@tonic-gate 	(void) devfsadm_mklink(path, node, minor, 0);
180*7c478bd9Sstevel@tonic-gate 
181*7c478bd9Sstevel@tonic-gate 	return (DEVFSADM_CONTINUE);
182*7c478bd9Sstevel@tonic-gate }
183*7c478bd9Sstevel@tonic-gate 
184*7c478bd9Sstevel@tonic-gate 
185*7c478bd9Sstevel@tonic-gate /*
186*7c478bd9Sstevel@tonic-gate  * get_roothub:
187*7c478bd9Sstevel@tonic-gate  *	figure out the root hub path to calculate /dev/cfg/usbN
188*7c478bd9Sstevel@tonic-gate  */
189*7c478bd9Sstevel@tonic-gate /* ARGSUSED */
190*7c478bd9Sstevel@tonic-gate static char *
191*7c478bd9Sstevel@tonic-gate get_roothub(const char *path, void *cb_arg)
192*7c478bd9Sstevel@tonic-gate {
193*7c478bd9Sstevel@tonic-gate 	int  i, count = 0;
194*7c478bd9Sstevel@tonic-gate 	char *physpath, *cp;
195*7c478bd9Sstevel@tonic-gate 
196*7c478bd9Sstevel@tonic-gate 	/* make a copy */
197*7c478bd9Sstevel@tonic-gate 	if ((physpath = strdup(path)) == NULL) {
198*7c478bd9Sstevel@tonic-gate 		return (NULL);
199*7c478bd9Sstevel@tonic-gate 	}
200*7c478bd9Sstevel@tonic-gate 
201*7c478bd9Sstevel@tonic-gate 	/*
202*7c478bd9Sstevel@tonic-gate 	 * physpath must always have a minor name component
203*7c478bd9Sstevel@tonic-gate 	 */
204*7c478bd9Sstevel@tonic-gate 	if ((cp = strrchr(physpath, ':')) == NULL) {
205*7c478bd9Sstevel@tonic-gate 		free(physpath);
206*7c478bd9Sstevel@tonic-gate 		return (NULL);
207*7c478bd9Sstevel@tonic-gate 	}
208*7c478bd9Sstevel@tonic-gate 	*cp++ = '\0';
209*7c478bd9Sstevel@tonic-gate 
210*7c478bd9Sstevel@tonic-gate 	/*
211*7c478bd9Sstevel@tonic-gate 	 * No '.' in the minor name indicates a roothub port.
212*7c478bd9Sstevel@tonic-gate 	 */
213*7c478bd9Sstevel@tonic-gate 	if (strchr(cp, '.') == NULL) {
214*7c478bd9Sstevel@tonic-gate 		/* roothub device */
215*7c478bd9Sstevel@tonic-gate 		return (physpath);
216*7c478bd9Sstevel@tonic-gate 	}
217*7c478bd9Sstevel@tonic-gate 
218*7c478bd9Sstevel@tonic-gate 	while (*cp) {
219*7c478bd9Sstevel@tonic-gate 		if (*cp == '.')
220*7c478bd9Sstevel@tonic-gate 			count++;
221*7c478bd9Sstevel@tonic-gate 		cp++;
222*7c478bd9Sstevel@tonic-gate 	}
223*7c478bd9Sstevel@tonic-gate 
224*7c478bd9Sstevel@tonic-gate 	/* Remove as many trailing path components as there are '.'s */
225*7c478bd9Sstevel@tonic-gate 	for (i = 0; i < count; i++) {
226*7c478bd9Sstevel@tonic-gate 		if ((cp = strrchr(physpath, '/')) == NULL || (cp == physpath)) {
227*7c478bd9Sstevel@tonic-gate 			free(physpath);
228*7c478bd9Sstevel@tonic-gate 			return (NULL);
229*7c478bd9Sstevel@tonic-gate 		}
230*7c478bd9Sstevel@tonic-gate 		*cp = '\0';
231*7c478bd9Sstevel@tonic-gate 	}
232*7c478bd9Sstevel@tonic-gate 
233*7c478bd9Sstevel@tonic-gate 	return (physpath);
234*7c478bd9Sstevel@tonic-gate }
235*7c478bd9Sstevel@tonic-gate 
236*7c478bd9Sstevel@tonic-gate 
237*7c478bd9Sstevel@tonic-gate /*
238*7c478bd9Sstevel@tonic-gate  * pci_cfg_creat_cb() search the <device mask> data from
239*7c478bd9Sstevel@tonic-gate  * "slot-names" PROM property for the match device number,
240*7c478bd9Sstevel@tonic-gate  * then create device link with the right slot label.
241*7c478bd9Sstevel@tonic-gate  */
242*7c478bd9Sstevel@tonic-gate static int
243*7c478bd9Sstevel@tonic-gate pci_cfg_creat_cb(di_minor_t minor, di_node_t node)
244*7c478bd9Sstevel@tonic-gate {
245*7c478bd9Sstevel@tonic-gate 	char		*minor_name, *dev_path;
246*7c478bd9Sstevel@tonic-gate 	char		path[PATH_MAX + 1];
247*7c478bd9Sstevel@tonic-gate 	int		*devlink_flags;
248*7c478bd9Sstevel@tonic-gate 	minor_t		pci_dev;
249*7c478bd9Sstevel@tonic-gate 	di_node_t	dev_node;
250*7c478bd9Sstevel@tonic-gate 
251*7c478bd9Sstevel@tonic-gate 	minor_name = di_minor_name(minor);
252*7c478bd9Sstevel@tonic-gate 	pci_dev = (minor->dev_minor) & 0xFF;
253*7c478bd9Sstevel@tonic-gate 
254*7c478bd9Sstevel@tonic-gate 	dev_path = di_devfs_path(node);
255*7c478bd9Sstevel@tonic-gate 	dev_node = di_init(dev_path, DINFOCPYALL);
256*7c478bd9Sstevel@tonic-gate 	if ((di_prop_lookup_ints(DDI_DEV_T_ANY, dev_node,
257*7c478bd9Sstevel@tonic-gate 			"ap-names", &devlink_flags)) > 0) {
258*7c478bd9Sstevel@tonic-gate 		if ((*devlink_flags) & (1 << pci_dev)) {
259*7c478bd9Sstevel@tonic-gate 			(void) snprintf(path, sizeof (path), "%s/%s",
260*7c478bd9Sstevel@tonic-gate 			    CFG_DIRNAME, minor_name);
261*7c478bd9Sstevel@tonic-gate 			(void) devfsadm_mklink(path, node, minor, 0);
262*7c478bd9Sstevel@tonic-gate 		}
263*7c478bd9Sstevel@tonic-gate 	}
264*7c478bd9Sstevel@tonic-gate 	di_fini(dev_node);
265*7c478bd9Sstevel@tonic-gate 	(void) di_devfs_path_free(dev_path);
266*7c478bd9Sstevel@tonic-gate 
267*7c478bd9Sstevel@tonic-gate 	return (DEVFSADM_CONTINUE);
268*7c478bd9Sstevel@tonic-gate }
269*7c478bd9Sstevel@tonic-gate 
270*7c478bd9Sstevel@tonic-gate 
271*7c478bd9Sstevel@tonic-gate /*
272*7c478bd9Sstevel@tonic-gate  * ib_cfg_creat_cb() creates two types of links
273*7c478bd9Sstevel@tonic-gate  * One for the fabric as /dev/cfg/ib
274*7c478bd9Sstevel@tonic-gate  * Another for each HCA seen in the fabric as /dev/cfg/hca:<HCA-GUID>
275*7c478bd9Sstevel@tonic-gate  */
276*7c478bd9Sstevel@tonic-gate static int
277*7c478bd9Sstevel@tonic-gate ib_cfg_creat_cb(di_minor_t minor, di_node_t node)
278*7c478bd9Sstevel@tonic-gate {
279*7c478bd9Sstevel@tonic-gate 	char	*cp;
280*7c478bd9Sstevel@tonic-gate 	char	path[PATH_MAX + 1];
281*7c478bd9Sstevel@tonic-gate 
282*7c478bd9Sstevel@tonic-gate 	if ((cp = di_devfs_path(node)) == NULL) {
283*7c478bd9Sstevel@tonic-gate 		return (DEVFSADM_CONTINUE);
284*7c478bd9Sstevel@tonic-gate 	}
285*7c478bd9Sstevel@tonic-gate 
286*7c478bd9Sstevel@tonic-gate 	(void) snprintf(path, sizeof (path), "%s:%s", cp, di_minor_name(minor));
287*7c478bd9Sstevel@tonic-gate 	di_devfs_path_free(cp);
288*7c478bd9Sstevel@tonic-gate 
289*7c478bd9Sstevel@tonic-gate 	/* create fabric or hca:GUID and the symlink */
290*7c478bd9Sstevel@tonic-gate 	if (strstr(path, "ib:fabric") != NULL) {
291*7c478bd9Sstevel@tonic-gate 		(void) snprintf(path, sizeof (path), "%s/ib", CFG_DIRNAME);
292*7c478bd9Sstevel@tonic-gate 	} else {
293*7c478bd9Sstevel@tonic-gate 		(void) snprintf(path, sizeof (path), "%s/hca:%s", CFG_DIRNAME,
294*7c478bd9Sstevel@tonic-gate 		    di_minor_name(minor));
295*7c478bd9Sstevel@tonic-gate 	}
296*7c478bd9Sstevel@tonic-gate 
297*7c478bd9Sstevel@tonic-gate 	(void) devfsadm_mklink(path, node, minor, 0);
298*7c478bd9Sstevel@tonic-gate 	return (DEVFSADM_CONTINUE);
299*7c478bd9Sstevel@tonic-gate }
300