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.
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.
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]
22 * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
23 * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
24 * Copyright (c) 2015, Joyent, Inc. All rights reserved.
34 #include <sys/zcons.h>
35 #include <sys/cpuid_drv.h>
37 static int display(di_minor_t minor
, di_node_t node
);
38 static int parallel(di_minor_t minor
, di_node_t node
);
39 static int node_slash_minor(di_minor_t minor
, di_node_t node
);
40 static int driver_minor(di_minor_t minor
, di_node_t node
);
41 static int node_name(di_minor_t minor
, di_node_t node
);
42 static int minor_name(di_minor_t minor
, di_node_t node
);
43 static int wifi_minor_name(di_minor_t minor
, di_node_t node
);
44 static int conskbd(di_minor_t minor
, di_node_t node
);
45 static int consms(di_minor_t minor
, di_node_t node
);
46 static int power_button(di_minor_t minor
, di_node_t node
);
47 static int fc_port(di_minor_t minor
, di_node_t node
);
48 static int printer_create(di_minor_t minor
, di_node_t node
);
49 static int se_hdlc_create(di_minor_t minor
, di_node_t node
);
50 static int ppm(di_minor_t minor
, di_node_t node
);
51 static int gpio(di_minor_t minor
, di_node_t node
);
52 static int av_create(di_minor_t minor
, di_node_t node
);
53 static int tsalarm_create(di_minor_t minor
, di_node_t node
);
54 static int ntwdt_create(di_minor_t minor
, di_node_t node
);
55 static int zcons_create(di_minor_t minor
, di_node_t node
);
56 static int cpuid(di_minor_t minor
, di_node_t node
);
57 static int glvc(di_minor_t minor
, di_node_t node
);
58 static int ses_callback(di_minor_t minor
, di_node_t node
);
59 static int kmdrv_create(di_minor_t minor
, di_node_t node
);
61 static devfsadm_create_t misc_cbt
[] = {
62 { "pseudo", "ddi_pseudo", "(^sad$)",
63 TYPE_EXACT
| DRV_RE
, ILEVEL_0
, node_slash_minor
65 { "pseudo", "ddi_pseudo", "zsh",
66 TYPE_EXACT
| DRV_EXACT
, ILEVEL_0
, driver_minor
68 { "network", "ddi_network", NULL
,
69 TYPE_EXACT
, ILEVEL_0
, minor_name
71 { "wifi", "ddi_network:wifi", NULL
,
72 TYPE_EXACT
, ILEVEL_0
, wifi_minor_name
74 { "display", "ddi_display", NULL
,
75 TYPE_EXACT
, ILEVEL_0
, display
77 { "parallel", "ddi_parallel", NULL
,
78 TYPE_EXACT
, ILEVEL_0
, parallel
80 { "enclosure", DDI_NT_SCSI_ENCLOSURE
, NULL
,
81 TYPE_EXACT
, ILEVEL_0
, ses_callback
83 { "pseudo", "ddi_pseudo", "(^winlock$)|(^pm$)",
84 TYPE_EXACT
| DRV_RE
, ILEVEL_0
, node_name
86 { "pseudo", "ddi_pseudo", "conskbd",
87 TYPE_EXACT
| DRV_EXACT
, ILEVEL_0
, conskbd
89 { "pseudo", "ddi_pseudo", "consms",
90 TYPE_EXACT
| DRV_EXACT
, ILEVEL_0
, consms
92 { "pseudo", "ddi_pseudo", "eventfd",
93 TYPE_EXACT
| DRV_EXACT
, ILEVEL_0
, minor_name
95 { "pseudo", "ddi_pseudo", "signalfd",
96 TYPE_EXACT
| DRV_EXACT
, ILEVEL_0
, minor_name
98 { "pseudo", "ddi_pseudo", "rsm",
99 TYPE_EXACT
| DRV_EXACT
, ILEVEL_0
, minor_name
101 { "pseudo", "ddi_pseudo",
102 "(^lockstat$)|(^SUNW,rtvc$)|(^vol$)|(^log$)|(^sy$)|"
103 "(^ksyms$)|(^clone$)|(^tl$)|(^tnf$)|(^kstat$)|(^mdesc$)|(^eeprom$)|"
104 "(^ptsl$)|(^mm$)|(^wc$)|(^dump$)|(^cn$)|(^ptm$)|"
105 "(^ptc$)|(^openeepr$)|(^poll$)|(^sysmsg$)|(^random$)|(^trapstat$)|"
106 "(^cryptoadm$)|(^crypto$)|(^pool$)|(^poolctl$)|(^bl$)|(^kmdb$)|"
107 "(^sysevent$)|(^physmem$)",
108 TYPE_EXACT
| DRV_RE
, ILEVEL_1
, minor_name
110 { "pseudo", "ddi_pseudo",
111 "(^ip$)|(^tcp$)|(^udp$)|(^icmp$)|"
112 "(^ip6$)|(^tcp6$)|(^udp6$)|(^icmp6$)|"
113 "(^rts$)|(^arp$)|(^ipsecah$)|(^ipsecesp$)|(^keysock$)|(^spdsock$)|"
114 "(^nca$)|(^rds$)|(^sdp$)|(^ipnet$)|(^dlpistub$)|(^bpf$)",
115 TYPE_EXACT
| DRV_RE
, ILEVEL_1
, minor_name
117 { "pseudo", "ddi_pseudo", "ipd",
118 TYPE_EXACT
| DRV_EXACT
, ILEVEL_0
, minor_name
120 { "pseudo", "ddi_pseudo",
121 "(^ipf$)|(^ipnat$)|(^ipstate$)|(^ipauth$)|"
122 "(^ipsync$)|(^ipscan$)|(^iplookup$)",
123 TYPE_EXACT
| DRV_RE
, ILEVEL_0
, minor_name
,
125 { "pseudo", "ddi_pseudo", "dld",
126 TYPE_EXACT
| DRV_EXACT
, ILEVEL_0
, node_name
128 { "pseudo", "ddi_pseudo",
129 "(^kdmouse$)|(^rootprop$)",
130 TYPE_EXACT
| DRV_RE
, ILEVEL_0
, node_name
132 { "pseudo", "ddi_pseudo", "timerfd",
133 TYPE_EXACT
| DRV_EXACT
, ILEVEL_0
, minor_name
135 { "pseudo", "ddi_pseudo", "tod",
136 TYPE_EXACT
| DRV_EXACT
, ILEVEL_0
, node_name
138 { "pseudo", "ddi_pseudo", "envctrl(two)?",
139 TYPE_EXACT
| DRV_RE
, ILEVEL_1
, minor_name
,
141 { "pseudo", "ddi_pseudo", "fcode",
142 TYPE_EXACT
| DRV_RE
, ILEVEL_0
, minor_name
,
144 { "power_button", "ddi_power_button", NULL
,
145 TYPE_EXACT
, ILEVEL_0
, power_button
,
147 { "FC port", "ddi_ctl:devctl", "fp",
148 TYPE_EXACT
| DRV_EXACT
, ILEVEL_0
, fc_port
150 { "printer", "ddi_printer", NULL
,
151 TYPE_EXACT
, ILEVEL_0
, printer_create
153 { "pseudo", "ddi_pseudo", "se",
154 TYPE_EXACT
| DRV_EXACT
, ILEVEL_0
, se_hdlc_create
156 { "ppm", "ddi_ppm", NULL
,
157 TYPE_EXACT
, ILEVEL_0
, ppm
159 { "pseudo", "ddi_pseudo", "gpio_87317",
160 TYPE_EXACT
| DRV_EXACT
, ILEVEL_0
, gpio
162 { "pseudo", "ddi_pseudo", "sckmdrv",
163 TYPE_EXACT
| DRV_RE
, ILEVEL_0
, kmdrv_create
,
165 { "pseudo", "ddi_pseudo", "oplkmdrv",
166 TYPE_EXACT
| DRV_RE
, ILEVEL_0
, kmdrv_create
,
168 { "av", "^ddi_av:(isoch|async)$", NULL
,
169 TYPE_RE
, ILEVEL_0
, av_create
,
171 { "pseudo", "ddi_pseudo", "tsalarm",
172 TYPE_EXACT
| DRV_RE
, ILEVEL_0
, tsalarm_create
,
174 { "pseudo", "ddi_pseudo", "ntwdt",
175 TYPE_EXACT
| DRV_RE
, ILEVEL_0
, ntwdt_create
,
177 { "pseudo", "ddi_pseudo", "daplt",
178 TYPE_EXACT
| DRV_EXACT
, ILEVEL_0
, minor_name
180 { "pseudo", "ddi_pseudo", "zcons",
181 TYPE_EXACT
| DRV_EXACT
, ILEVEL_0
, zcons_create
,
183 { "pseudo", "ddi_pseudo", CPUID_DRIVER_NAME
,
184 TYPE_EXACT
| DRV_EXACT
, ILEVEL_0
, cpuid
,
186 { "pseudo", "ddi_pseudo", "glvc",
187 TYPE_EXACT
| DRV_EXACT
, ILEVEL_0
, glvc
,
189 { "pseudo", "ddi_pseudo", "dm2s",
190 TYPE_EXACT
| DRV_EXACT
, ILEVEL_0
, minor_name
,
192 { "pseudo", "ddi_pseudo", "nsmb",
193 TYPE_EXACT
| DRV_EXACT
, ILEVEL_1
, minor_name
,
195 { "pseudo", "ddi_pseudo", "mem_cache",
196 TYPE_EXACT
| DRV_RE
, ILEVEL_1
, minor_name
,
198 { "pseudo", "ddi_pseudo", "fm",
199 TYPE_EXACT
| DRV_RE
, ILEVEL_1
, minor_name
,
201 { "pseudo", "ddi_pseudo", "smbsrv",
202 TYPE_EXACT
| DRV_EXACT
, ILEVEL_1
, minor_name
,
206 DEVFSADM_CREATE_INIT_V0(misc_cbt
);
208 static devfsadm_remove_t misc_remove_cbt
[] = {
209 { "pseudo", "^profile$",
210 RM_PRE
| RM_ALWAYS
, ILEVEL_0
, devfsadm_rm_all
213 RM_PRE
| RM_ALWAYS
, ILEVEL_0
, devfsadm_rm_all
215 { "printer", "^printers/[0-9]+$",
216 RM_PRE
| RM_HOT
| RM_ALWAYS
, ILEVEL_0
, devfsadm_rm_all
218 { "av", "^av/[0-9]+/(async|isoch)$",
219 RM_PRE
| RM_HOT
| RM_ALWAYS
, ILEVEL_0
, devfsadm_rm_all
221 { "pseudo", "^daplt$",
222 RM_PRE
| RM_ALWAYS
, ILEVEL_0
, devfsadm_rm_all
224 { "pseudo", "^zcons/" ZONENAME_REGEXP
"/(" ZCONS_MASTER_NAME
"|"
225 ZCONS_SLAVE_NAME
")$",
226 RM_PRE
| RM_HOT
| RM_ALWAYS
, ILEVEL_0
, devfsadm_rm_all
228 { "pseudo", "^" CPUID_SELF_NAME
"$", RM_ALWAYS
| RM_PRE
| RM_HOT
,
229 ILEVEL_0
, devfsadm_rm_all
231 { "enclosure", "^es/ses[0-9]+$", RM_POST
,
232 ILEVEL_0
, devfsadm_rm_all
234 { "pseudo", "^pfil$",
235 RM_PRE
| RM_ALWAYS
, ILEVEL_0
, devfsadm_rm_all
237 { "pseudo", "^sctp|sctp6$",
238 RM_PRE
| RM_ALWAYS
, ILEVEL_0
, devfsadm_rm_link
242 /* Rules for gpio devices */
243 static devfsadm_enumerate_t gpio_rules
[1] =
244 {"^gpio([0-9]+)$", 1, MATCH_ALL
};
246 DEVFSADM_REMOVE_INIT_V0(misc_remove_cbt
);
249 * Handles minor node type "ddi_display".
251 * type=ddi_display fbs/\M0 fb\N0
254 display(di_minor_t minor
, di_node_t node
)
256 char l_path
[PATH_MAX
+ 1], contents
[PATH_MAX
+ 1], *buf
;
257 devfsadm_enumerate_t rules
[1] = {"^fb([0-9]+)$", 1, MATCH_ALL
};
258 char *mn
= di_minor_name(minor
);
260 /* create fbs/\M0 primary link */
261 (void) strcpy(l_path
, "fbs/");
262 (void) strcat(l_path
, mn
);
263 (void) devfsadm_mklink(l_path
, node
, minor
, 0);
265 /* create fb\N0 which links to fbs/\M0 */
266 if (devfsadm_enumerate_int(l_path
, 0, &buf
, rules
, 1)) {
267 return (DEVFSADM_CONTINUE
);
269 (void) strcpy(contents
, l_path
);
270 (void) strcpy(l_path
, "fb");
271 (void) strcat(l_path
, buf
);
273 (void) devfsadm_secondary_link(l_path
, contents
, 0);
274 return (DEVFSADM_CONTINUE
);
278 * Handles minor node type "ddi_parallel".
279 * type=ddi_parallel;name=mcpp mcpp\N0
282 parallel(di_minor_t minor
, di_node_t node
)
284 char path
[PATH_MAX
+ 1], *buf
;
285 devfsadm_enumerate_t rules
[1] = {"mcpp([0-9]+)$", 1, MATCH_ALL
};
288 if (strcmp(di_node_name(node
), "mcpp") != 0) {
289 return (DEVFSADM_CONTINUE
);
292 if (NULL
== (buf
= di_devfs_path(node
))) {
293 return (DEVFSADM_CONTINUE
);
296 (void) snprintf(path
, sizeof (path
), "%s:%s",
297 buf
, di_minor_name(minor
));
299 di_devfs_path_free(buf
);
301 if (devfsadm_enumerate_int(path
, 0, &buf
, rules
, 1)) {
302 return (DEVFSADM_CONTINUE
);
304 (void) snprintf(path
, sizeof (path
), "mcpp%s", buf
);
307 (void) devfsadm_mklink(path
, node
, minor
, 0);
308 return (DEVFSADM_CONTINUE
);
312 ses_callback(di_minor_t minor
, di_node_t node
)
314 char l_path
[PATH_MAX
];
317 char p_path
[PATH_MAX
];
318 devfsadm_enumerate_t re
[] = {"^es$/^ses([0-9]+)$", 1, MATCH_ALL
};
320 /* find devices path -- need to free mem */
321 if (NULL
== (devfspath
= di_devfs_path(node
))) {
322 return (DEVFSADM_CONTINUE
);
325 (void) snprintf(p_path
, sizeof (p_path
), "%s:%s", devfspath
,
326 di_minor_name(minor
));
329 /* find next number to use; buf is an ascii number */
330 if (devfsadm_enumerate_int(p_path
, 0, &buf
, re
, 1)) {
332 di_devfs_path_free(devfspath
);
333 return (DEVFSADM_CONTINUE
);
336 (void) snprintf(l_path
, sizeof (l_path
), "es/ses%s", buf
);
338 (void) devfsadm_mklink(l_path
, node
, minor
, 0);
341 di_devfs_path_free(devfspath
);
342 return (DEVFSADM_CONTINUE
);
347 node_slash_minor(di_minor_t minor
, di_node_t node
)
350 char path
[PATH_MAX
+ 1];
352 (void) strcpy(path
, di_node_name(node
));
353 (void) strcat(path
, "/");
354 (void) strcat(path
, di_minor_name(minor
));
355 (void) devfsadm_mklink(path
, node
, minor
, 0);
356 return (DEVFSADM_CONTINUE
);
360 driver_minor(di_minor_t minor
, di_node_t node
)
362 char path
[PATH_MAX
+ 1];
364 (void) strcpy(path
, di_driver_name(node
));
365 (void) strcat(path
, di_minor_name(minor
));
366 (void) devfsadm_mklink(path
, node
, minor
, 0);
367 return (DEVFSADM_CONTINUE
);
371 * Handles links of the form:
372 * type=ddi_pseudo;name=xyz \D
375 node_name(di_minor_t minor
, di_node_t node
)
377 (void) devfsadm_mklink(di_node_name(node
), node
, minor
, 0);
378 return (DEVFSADM_CONTINUE
);
382 * Handles links of the form:
383 * type=ddi_pseudo;name=xyz \M0
386 minor_name(di_minor_t minor
, di_node_t node
)
388 char *mn
= di_minor_name(minor
);
390 (void) devfsadm_mklink(mn
, node
, minor
, 0);
391 if (strcmp(mn
, "icmp") == 0) {
392 (void) devfsadm_mklink("rawip", node
, minor
, 0);
394 if (strcmp(mn
, "icmp6") == 0) {
395 (void) devfsadm_mklink("rawip6", node
, minor
, 0);
397 if (strcmp(mn
, "ipf") == 0) {
398 (void) devfsadm_mklink("ipl", node
, minor
, 0);
400 return (DEVFSADM_CONTINUE
);
404 * create links at /dev/wifi for wifi minor node
407 wifi_minor_name(di_minor_t minor
, di_node_t node
)
410 char *mn
= di_minor_name(minor
);
412 (void) snprintf(buf
, sizeof (buf
), "%s%s", "wifi/", mn
);
413 (void) devfsadm_mklink(buf
, node
, minor
, 0);
415 return (DEVFSADM_CONTINUE
);
419 conskbd(di_minor_t minor
, di_node_t node
)
421 (void) devfsadm_mklink("kbd", node
, minor
, 0);
422 return (DEVFSADM_CONTINUE
);
426 consms(di_minor_t minor
, di_node_t node
)
428 (void) devfsadm_mklink("mouse", node
, minor
, 0);
429 return (DEVFSADM_CONTINUE
);
433 power_button(di_minor_t minor
, di_node_t node
)
435 (void) devfsadm_mklink("power_button", node
, minor
, 0);
436 return (DEVFSADM_CONTINUE
);
440 fc_port(di_minor_t minor
, di_node_t node
)
442 devfsadm_enumerate_t rules
[1] = {"fc/fp([0-9]+)$", 1, MATCH_ALL
};
443 char *buf
, path
[PATH_MAX
+ 1];
446 if (NULL
== (ptr
= di_devfs_path(node
))) {
447 return (DEVFSADM_CONTINUE
);
450 (void) strcpy(path
, ptr
);
451 (void) strcat(path
, ":");
452 (void) strcat(path
, di_minor_name(minor
));
454 di_devfs_path_free(ptr
);
456 if (devfsadm_enumerate_int(path
, 0, &buf
, rules
, 1) != 0) {
457 return (DEVFSADM_CONTINUE
);
460 (void) strcpy(path
, "fc/fp");
461 (void) strcat(path
, buf
);
464 (void) devfsadm_mklink(path
, node
, minor
, 0);
465 return (DEVFSADM_CONTINUE
);
470 * minor node type "ddi_printer".
471 * rules of the form: type=ddi_printer;name=bpp \M0
474 printer_create(di_minor_t minor
, di_node_t node
)
477 char path
[PATH_MAX
+ 1], *buf
;
478 devfsadm_enumerate_t rules
[1] = {"^printers$/^([0-9]+)$", 1, MATCH_ALL
};
480 mn
= di_minor_name(minor
);
482 if (strcmp(di_driver_name(node
), "bpp") == 0) {
483 (void) devfsadm_mklink(mn
, node
, minor
, 0);
486 if (NULL
== (buf
= di_devfs_path(node
))) {
487 return (DEVFSADM_CONTINUE
);
490 (void) snprintf(path
, sizeof (path
), "%s:%s", buf
, mn
);
491 di_devfs_path_free(buf
);
493 if (devfsadm_enumerate_int(path
, 0, &buf
, rules
, 1)) {
494 return (DEVFSADM_CONTINUE
);
497 (void) snprintf(path
, sizeof (path
), "printers/%s", buf
);
500 (void) devfsadm_mklink(path
, node
, minor
, 0);
502 return (DEVFSADM_CONTINUE
);
506 * Handles links of the form:
507 * type=ddi_pseudo;name=se;minor2=hdlc se_hdlc\N0
508 * type=ddi_pseudo;name=serial;minor2=hdlc se_hdlc\N0
511 se_hdlc_create(di_minor_t minor
, di_node_t node
)
513 devfsadm_enumerate_t rules
[1] = {"^se_hdlc([0-9]+)$", 1, MATCH_ALL
};
514 char *buf
, path
[PATH_MAX
+ 1];
518 mn
= di_minor_name(minor
);
520 /* minor node should be of the form: "?,hdlc" */
521 if (strcmp(mn
+ 1, ",hdlc") != 0) {
522 return (DEVFSADM_CONTINUE
);
525 if (NULL
== (ptr
= di_devfs_path(node
))) {
526 return (DEVFSADM_CONTINUE
);
529 (void) strcpy(path
, ptr
);
530 (void) strcat(path
, ":");
531 (void) strcat(path
, mn
);
533 di_devfs_path_free(ptr
);
535 if (devfsadm_enumerate_int(path
, 0, &buf
, rules
, 1) != 0) {
536 return (DEVFSADM_CONTINUE
);
539 (void) strcpy(path
, "se_hdlc");
540 (void) strcat(path
, buf
);
543 (void) devfsadm_mklink(path
, node
, minor
, 0);
545 return (DEVFSADM_CONTINUE
);
549 gpio(di_minor_t minor
, di_node_t node
)
551 char l_path
[PATH_MAX
], p_path
[PATH_MAX
], *buf
, *devfspath
;
552 char *minor_nm
, *drvr_nm
;
555 minor_nm
= di_minor_name(minor
);
556 drvr_nm
= di_driver_name(node
);
557 if ((minor_nm
== NULL
) || (drvr_nm
== NULL
)) {
558 return (DEVFSADM_CONTINUE
);
561 devfspath
= di_devfs_path(node
);
563 (void) strcpy(p_path
, devfspath
);
564 (void) strcat(p_path
, ":");
565 (void) strcat(p_path
, minor_nm
);
566 di_devfs_path_free(devfspath
);
568 /* build the physical path from the components */
569 if (devfsadm_enumerate_int(p_path
, 0, &buf
, gpio_rules
, 1)) {
570 return (DEVFSADM_CONTINUE
);
573 (void) snprintf(l_path
, sizeof (l_path
), "%s%s", "gpio", buf
);
577 (void) devfsadm_mklink(l_path
, node
, minor
, 0);
579 return (DEVFSADM_CONTINUE
);
583 * Creates /dev/ppm nodes for Platform Specific PM module
586 ppm(di_minor_t minor
, di_node_t node
)
588 (void) devfsadm_mklink("ppm", node
, minor
, 0);
589 return (DEVFSADM_CONTINUE
);
594 * /dev/av/[0-9]+/(async|isoch)
597 av_create(di_minor_t minor
, di_node_t node
)
599 devfsadm_enumerate_t rules
[1] = {"^av$/^([0-9]+)$", 1, MATCH_ADDR
};
601 char path
[PATH_MAX
+ 1];
604 if ((buf
= di_devfs_path(node
)) == NULL
) {
605 return (DEVFSADM_CONTINUE
);
608 minor_str
= di_minor_name(minor
);
609 (void) snprintf(path
, sizeof (path
), "%s:%s", buf
, minor_str
);
610 di_devfs_path_free(buf
);
612 if (devfsadm_enumerate_int(path
, 0, &buf
, rules
, 1)) {
613 return (DEVFSADM_CONTINUE
);
616 (void) snprintf(path
, sizeof (path
), "av/%s/%s", buf
, minor_str
);
619 (void) devfsadm_mklink(path
, node
, minor
, 0);
621 return (DEVFSADM_CONTINUE
);
625 * Creates /dev/lom and /dev/tsalarm:ctl for tsalarm node
628 tsalarm_create(di_minor_t minor
, di_node_t node
)
630 char buf
[PATH_MAX
+ 1];
631 char *mn
= di_minor_name(minor
);
633 (void) snprintf(buf
, sizeof (buf
), "%s%s", di_node_name(node
), ":ctl");
635 (void) devfsadm_mklink(mn
, node
, minor
, 0);
636 (void) devfsadm_mklink(buf
, node
, minor
, 0);
638 return (DEVFSADM_CONTINUE
);
642 * Creates /dev/ntwdt for ntwdt node
645 ntwdt_create(di_minor_t minor
, di_node_t node
)
647 (void) devfsadm_mklink("ntwdt", node
, minor
, 0);
648 return (DEVFSADM_CONTINUE
);
652 zcons_create(di_minor_t minor
, di_node_t node
)
656 char path
[MAXPATHLEN
];
658 minor_str
= di_minor_name(minor
);
660 if (di_prop_lookup_strings(DDI_DEV_T_ANY
, node
, "zonename",
662 return (DEVFSADM_CONTINUE
);
665 (void) snprintf(path
, sizeof (path
), "zcons/%s/%s", zonename
,
667 (void) devfsadm_mklink(path
, node
, minor
, 0);
669 return (DEVFSADM_CONTINUE
);
673 * /dev/cpu/self/cpuid -> /devices/pseudo/cpuid@0:self
676 cpuid(di_minor_t minor
, di_node_t node
)
678 (void) devfsadm_mklink(CPUID_SELF_NAME
, node
, minor
, 0);
679 return (DEVFSADM_CONTINUE
);
684 * /dev/spfma -> /devices/virtual-devices/fma@5:glvc
687 glvc(di_minor_t minor
, di_node_t node
)
689 char node_name
[MAXNAMELEN
+ 1];
691 (void) strcpy(node_name
, di_node_name(node
));
693 if (strncmp(node_name
, "fma", 3) == 0) {
694 /* Only one fma channel */
695 (void) devfsadm_mklink("spfma", node
, minor
, 0);
697 return (DEVFSADM_CONTINUE
);
701 * Handles links of the form:
702 * type=ddi_pseudo;name=sckmdrv kmdrv\M0
703 * type=ddi_pseudo;name=oplkmdrv kmdrv\M0
706 kmdrv_create(di_minor_t minor
, di_node_t node
)
709 (void) devfsadm_mklink("kmdrv", node
, minor
, 0);
710 return (DEVFSADM_CONTINUE
);