17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 57c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 67c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 77c478bd9Sstevel@tonic-gate * with the License. 87c478bd9Sstevel@tonic-gate * 97c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 107c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 117c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 127c478bd9Sstevel@tonic-gate * and limitations under the License. 137c478bd9Sstevel@tonic-gate * 147c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 157c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 167c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 177c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 187c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 197c478bd9Sstevel@tonic-gate * 207c478bd9Sstevel@tonic-gate * CDDL HEADER END 217c478bd9Sstevel@tonic-gate */ 227c478bd9Sstevel@tonic-gate /* 237c478bd9Sstevel@tonic-gate * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 247c478bd9Sstevel@tonic-gate * Use is subject to license terms. 257c478bd9Sstevel@tonic-gate */ 267c478bd9Sstevel@tonic-gate 277c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate #include <regex.h> 307c478bd9Sstevel@tonic-gate #include <devfsadm.h> 317c478bd9Sstevel@tonic-gate #include <stdio.h> 327c478bd9Sstevel@tonic-gate #include <strings.h> 337c478bd9Sstevel@tonic-gate #include <stdlib.h> 347c478bd9Sstevel@tonic-gate #include <limits.h> 357c478bd9Sstevel@tonic-gate #include <sys/zone.h> 367c478bd9Sstevel@tonic-gate #include <sys/zcons.h> 377c478bd9Sstevel@tonic-gate #include <sys/cpuid_drv.h> 387c478bd9Sstevel@tonic-gate 397c478bd9Sstevel@tonic-gate static int display(di_minor_t minor, di_node_t node); 407c478bd9Sstevel@tonic-gate static int parallel(di_minor_t minor, di_node_t node); 417c478bd9Sstevel@tonic-gate static int node_slash_minor(di_minor_t minor, di_node_t node); 427c478bd9Sstevel@tonic-gate static int driver_minor(di_minor_t minor, di_node_t node); 437c478bd9Sstevel@tonic-gate static int node_name(di_minor_t minor, di_node_t node); 447c478bd9Sstevel@tonic-gate static int minor_name(di_minor_t minor, di_node_t node); 45*516fc7f3Shx147065 static int wifi_minor_name(di_minor_t minor, di_node_t node); 467c478bd9Sstevel@tonic-gate static int conskbd(di_minor_t minor, di_node_t node); 477c478bd9Sstevel@tonic-gate static int consms(di_minor_t minor, di_node_t node); 487c478bd9Sstevel@tonic-gate static int power_button(di_minor_t minor, di_node_t node); 497c478bd9Sstevel@tonic-gate static int fc_port(di_minor_t minor, di_node_t node); 507c478bd9Sstevel@tonic-gate static int printer_create(di_minor_t minor, di_node_t node); 517c478bd9Sstevel@tonic-gate static int se_hdlc_create(di_minor_t minor, di_node_t node); 527c478bd9Sstevel@tonic-gate static int ppm(di_minor_t minor, di_node_t node); 537c478bd9Sstevel@tonic-gate static int gpio(di_minor_t minor, di_node_t node); 547c478bd9Sstevel@tonic-gate static int av_create(di_minor_t minor, di_node_t node); 557c478bd9Sstevel@tonic-gate static int tsalarm_create(di_minor_t minor, di_node_t node); 56e3f8e17dSsc121708 static int ntwdt_create(di_minor_t minor, di_node_t node); 577c478bd9Sstevel@tonic-gate static int zcons_create(di_minor_t minor, di_node_t node); 587c478bd9Sstevel@tonic-gate static int cpuid(di_minor_t minor, di_node_t node); 597c478bd9Sstevel@tonic-gate static int glvc(di_minor_t minor, di_node_t node); 607c478bd9Sstevel@tonic-gate static int ses_callback(di_minor_t minor, di_node_t node); 617c478bd9Sstevel@tonic-gate 627c478bd9Sstevel@tonic-gate static devfsadm_create_t misc_cbt[] = { 637c478bd9Sstevel@tonic-gate { "pseudo", "ddi_pseudo", "(^pts$)|(^sad$)", 647c478bd9Sstevel@tonic-gate TYPE_EXACT | DRV_RE, ILEVEL_0, node_slash_minor 657c478bd9Sstevel@tonic-gate }, 667c478bd9Sstevel@tonic-gate { "pseudo", "ddi_pseudo", "zsh", 677c478bd9Sstevel@tonic-gate TYPE_EXACT | DRV_EXACT, ILEVEL_0, driver_minor 687c478bd9Sstevel@tonic-gate }, 697c478bd9Sstevel@tonic-gate { "network", "ddi_network", NULL, 707c478bd9Sstevel@tonic-gate TYPE_EXACT, ILEVEL_0, minor_name 717c478bd9Sstevel@tonic-gate }, 72*516fc7f3Shx147065 { "wifi", "ddi_network:wifi", NULL, 73*516fc7f3Shx147065 TYPE_EXACT, ILEVEL_0, wifi_minor_name 74*516fc7f3Shx147065 }, 757c478bd9Sstevel@tonic-gate { "display", "ddi_display", NULL, 767c478bd9Sstevel@tonic-gate TYPE_EXACT, ILEVEL_0, display 777c478bd9Sstevel@tonic-gate }, 787c478bd9Sstevel@tonic-gate { "parallel", "ddi_parallel", NULL, 797c478bd9Sstevel@tonic-gate TYPE_EXACT, ILEVEL_0, parallel 807c478bd9Sstevel@tonic-gate }, 817c478bd9Sstevel@tonic-gate { "enclosure", DDI_NT_SCSI_ENCLOSURE, NULL, 827c478bd9Sstevel@tonic-gate TYPE_EXACT, ILEVEL_0, ses_callback 837c478bd9Sstevel@tonic-gate }, 847c478bd9Sstevel@tonic-gate { "pseudo", "ddi_pseudo", "(^winlock$)|(^pm$)", 857c478bd9Sstevel@tonic-gate TYPE_EXACT | DRV_RE, ILEVEL_0, node_name 867c478bd9Sstevel@tonic-gate }, 877c478bd9Sstevel@tonic-gate { "pseudo", "ddi_pseudo", "conskbd", 887c478bd9Sstevel@tonic-gate TYPE_EXACT | DRV_EXACT, ILEVEL_0, conskbd 897c478bd9Sstevel@tonic-gate }, 907c478bd9Sstevel@tonic-gate { "pseudo", "ddi_pseudo", "consms", 917c478bd9Sstevel@tonic-gate TYPE_EXACT | DRV_EXACT, ILEVEL_0, consms 927c478bd9Sstevel@tonic-gate }, 937c478bd9Sstevel@tonic-gate { "pseudo", "ddi_pseudo", "rsm", 947c478bd9Sstevel@tonic-gate TYPE_EXACT | DRV_EXACT, ILEVEL_0, minor_name 957c478bd9Sstevel@tonic-gate }, 967c478bd9Sstevel@tonic-gate { "pseudo", "ddi_pseudo", 977c478bd9Sstevel@tonic-gate "(^lockstat$)|(^SUNW,rtvc$)|(^vol$)|(^log$)|(^sy$)|" 987c478bd9Sstevel@tonic-gate "(^ksyms$)|(^clone$)|(^tl$)|(^tnf$)|(^kstat$)|(^mdesc$)|" 997c478bd9Sstevel@tonic-gate "(^eeprom$)|(^ptsl$)|(^mm$)|(^wc$)|(^dump$)|(^cn$)|(^lo$)|(^ptm$)|" 1007c478bd9Sstevel@tonic-gate "(^ptc$)|(^openeepr$)|(^poll$)|(^sysmsg$)|(^random$)|(^trapstat$)|" 1017c478bd9Sstevel@tonic-gate "(^cryptoadm$)|(^crypto$)|(^pool$)|(^poolctl$)|(^bl$)|(^kmdb$)|" 102c28749e9Skais "(^sysevent$)|(^kssl$)", 1037c478bd9Sstevel@tonic-gate TYPE_EXACT | DRV_RE, ILEVEL_1, minor_name 1047c478bd9Sstevel@tonic-gate }, 1057c478bd9Sstevel@tonic-gate { "pseudo", "ddi_pseudo", 1067c478bd9Sstevel@tonic-gate "(^ip$)|(^tcp$)|(^udp$)|(^icmp$)|(^sctp$)|" 1077c478bd9Sstevel@tonic-gate "(^ip6$)|(^tcp6$)|(^udp6$)|(^icmp6$)|(^sctp6$)|" 1087c478bd9Sstevel@tonic-gate "(^rts$)|(^arp$)|(^ipsecah$)|(^ipsecesp$)|(^keysock$)|(^spdsock$)|" 1097c478bd9Sstevel@tonic-gate "(^nca$)", 1107c478bd9Sstevel@tonic-gate TYPE_EXACT | DRV_RE, ILEVEL_1, minor_name 1117c478bd9Sstevel@tonic-gate }, 1127c478bd9Sstevel@tonic-gate { "pseudo", "ddi_pseudo", 1137c478bd9Sstevel@tonic-gate "(^pfil$)|(^ipf$)|(^ipnat$)|(^ipstate$)|(^ipauth$)|" 1147c478bd9Sstevel@tonic-gate "(^ipsync$)|(^ipscan$)|(^iplookup$)", 1157c478bd9Sstevel@tonic-gate TYPE_EXACT | DRV_RE, ILEVEL_0, minor_name, 1167c478bd9Sstevel@tonic-gate }, 1177c478bd9Sstevel@tonic-gate { "pseudo", "ddi_pseudo", 1187c478bd9Sstevel@tonic-gate "(^kdmouse$)|(^logi$)|(^rootprop$)|(^msm$)", 1197c478bd9Sstevel@tonic-gate TYPE_EXACT | DRV_RE, ILEVEL_0, node_name 1207c478bd9Sstevel@tonic-gate }, 1217c478bd9Sstevel@tonic-gate { "pseudo", "ddi_pseudo", "tod", 1227c478bd9Sstevel@tonic-gate TYPE_EXACT | DRV_EXACT, ILEVEL_0, node_name 1237c478bd9Sstevel@tonic-gate }, 1247c478bd9Sstevel@tonic-gate { "pseudo", "ddi_pseudo", "envctrl(two)?", 1257c478bd9Sstevel@tonic-gate TYPE_EXACT | DRV_RE, ILEVEL_1, minor_name, 1267c478bd9Sstevel@tonic-gate }, 1277c478bd9Sstevel@tonic-gate { "pseudo", "ddi_pseudo", "fcode", 1287c478bd9Sstevel@tonic-gate TYPE_EXACT | DRV_RE, ILEVEL_0, minor_name, 1297c478bd9Sstevel@tonic-gate }, 1307c478bd9Sstevel@tonic-gate { "power_button", "ddi_power_button", NULL, 1317c478bd9Sstevel@tonic-gate TYPE_EXACT, ILEVEL_0, power_button, 1327c478bd9Sstevel@tonic-gate }, 1337c478bd9Sstevel@tonic-gate { "FC port", "ddi_ctl:devctl", "fp", 1347c478bd9Sstevel@tonic-gate TYPE_EXACT | DRV_EXACT, ILEVEL_0, fc_port 1357c478bd9Sstevel@tonic-gate }, 1367c478bd9Sstevel@tonic-gate { "printer", "ddi_printer", NULL, 1377c478bd9Sstevel@tonic-gate TYPE_EXACT, ILEVEL_0, printer_create 1387c478bd9Sstevel@tonic-gate }, 1397c478bd9Sstevel@tonic-gate { "pseudo", "ddi_pseudo", "se", 1407c478bd9Sstevel@tonic-gate TYPE_EXACT | DRV_EXACT, ILEVEL_0, se_hdlc_create 1417c478bd9Sstevel@tonic-gate }, 1427c478bd9Sstevel@tonic-gate { "ppm", "ddi_ppm", NULL, 1437c478bd9Sstevel@tonic-gate TYPE_EXACT, ILEVEL_0, ppm 1447c478bd9Sstevel@tonic-gate }, 1457c478bd9Sstevel@tonic-gate { "pseudo", "ddi_pseudo", "gpio_87317", 1467c478bd9Sstevel@tonic-gate TYPE_EXACT | DRV_EXACT, ILEVEL_0, gpio 1477c478bd9Sstevel@tonic-gate }, 1487c478bd9Sstevel@tonic-gate { "pseudo", "ddi_pseudo", "sckmdrv", 1497c478bd9Sstevel@tonic-gate TYPE_EXACT | DRV_RE, ILEVEL_0, minor_name, 1507c478bd9Sstevel@tonic-gate }, 1517c478bd9Sstevel@tonic-gate { "av", "^ddi_av:(isoch|async)$", NULL, 1527c478bd9Sstevel@tonic-gate TYPE_RE, ILEVEL_0, av_create, 1537c478bd9Sstevel@tonic-gate }, 1547c478bd9Sstevel@tonic-gate { "pseudo", "ddi_pseudo", "tsalarm", 1557c478bd9Sstevel@tonic-gate TYPE_EXACT | DRV_RE, ILEVEL_0, tsalarm_create, 1567c478bd9Sstevel@tonic-gate }, 157e3f8e17dSsc121708 { "pseudo", "ddi_pseudo", "ntwdt", 158e3f8e17dSsc121708 TYPE_EXACT | DRV_RE, ILEVEL_0, ntwdt_create, 159e3f8e17dSsc121708 }, 1607c478bd9Sstevel@tonic-gate { "pseudo", "ddi_pseudo", "daplt", 1617c478bd9Sstevel@tonic-gate TYPE_EXACT | DRV_EXACT, ILEVEL_0, minor_name 1627c478bd9Sstevel@tonic-gate }, 1637c478bd9Sstevel@tonic-gate { "pseudo", "ddi_pseudo", "zcons", 1647c478bd9Sstevel@tonic-gate TYPE_EXACT | DRV_EXACT, ILEVEL_0, zcons_create, 1657c478bd9Sstevel@tonic-gate }, 1667c478bd9Sstevel@tonic-gate { "pseudo", "ddi_pseudo", CPUID_DRIVER_NAME, 1677c478bd9Sstevel@tonic-gate TYPE_EXACT | DRV_EXACT, ILEVEL_0, cpuid, 1687c478bd9Sstevel@tonic-gate }, 1697c478bd9Sstevel@tonic-gate { "pseudo", "ddi_pseudo", "glvc", 1707c478bd9Sstevel@tonic-gate TYPE_EXACT | DRV_EXACT, ILEVEL_0, glvc, 1717c478bd9Sstevel@tonic-gate }, 1727c478bd9Sstevel@tonic-gate }; 1737c478bd9Sstevel@tonic-gate 1747c478bd9Sstevel@tonic-gate DEVFSADM_CREATE_INIT_V0(misc_cbt); 1757c478bd9Sstevel@tonic-gate 1767c478bd9Sstevel@tonic-gate static devfsadm_remove_t misc_remove_cbt[] = { 1777c478bd9Sstevel@tonic-gate { "pseudo", "^profile$", 1787c478bd9Sstevel@tonic-gate RM_PRE | RM_ALWAYS, ILEVEL_0, devfsadm_rm_all 1797c478bd9Sstevel@tonic-gate }, 1807c478bd9Sstevel@tonic-gate { "pseudo", "^rsm$", 1817c478bd9Sstevel@tonic-gate RM_PRE | RM_ALWAYS, ILEVEL_0, devfsadm_rm_all 1827c478bd9Sstevel@tonic-gate }, 1837c478bd9Sstevel@tonic-gate { "printer", "^printers/[0-9]+$", 1847c478bd9Sstevel@tonic-gate RM_PRE | RM_HOT | RM_ALWAYS, ILEVEL_0, devfsadm_rm_all 1857c478bd9Sstevel@tonic-gate }, 1867c478bd9Sstevel@tonic-gate { "av", "^av/[0-9]+/(async|isoch)$", 1877c478bd9Sstevel@tonic-gate RM_PRE | RM_HOT | RM_ALWAYS, ILEVEL_0, devfsadm_rm_all 1887c478bd9Sstevel@tonic-gate }, 1897c478bd9Sstevel@tonic-gate { "pseudo", "^daplt$", 1907c478bd9Sstevel@tonic-gate RM_PRE | RM_ALWAYS, ILEVEL_0, devfsadm_rm_all 1917c478bd9Sstevel@tonic-gate }, 1927c478bd9Sstevel@tonic-gate { "pseudo", "^zcons/" ZONENAME_REGEXP "/(" ZCONS_MASTER_NAME "|" 1937c478bd9Sstevel@tonic-gate ZCONS_SLAVE_NAME ")$", 1947c478bd9Sstevel@tonic-gate RM_PRE | RM_HOT | RM_ALWAYS, ILEVEL_0, devfsadm_rm_all 1957c478bd9Sstevel@tonic-gate }, 1967c478bd9Sstevel@tonic-gate { "pseudo", "^cpu/self/cpuid$", RM_ALWAYS | RM_PRE | RM_HOT, 1977c478bd9Sstevel@tonic-gate ILEVEL_0, devfsadm_rm_all 1987c478bd9Sstevel@tonic-gate }, 1997c478bd9Sstevel@tonic-gate { "enclosure", "^es/ses[0-9]+$", RM_POST, 2007c478bd9Sstevel@tonic-gate ILEVEL_0, devfsadm_rm_all 2017c478bd9Sstevel@tonic-gate } 2027c478bd9Sstevel@tonic-gate }; 2037c478bd9Sstevel@tonic-gate 2047c478bd9Sstevel@tonic-gate /* Rules for gpio devices */ 2057c478bd9Sstevel@tonic-gate static devfsadm_enumerate_t gpio_rules[1] = 2067c478bd9Sstevel@tonic-gate {"^gpio([0-9]+)$", 1, MATCH_ALL}; 2077c478bd9Sstevel@tonic-gate 2087c478bd9Sstevel@tonic-gate DEVFSADM_REMOVE_INIT_V0(misc_remove_cbt); 2097c478bd9Sstevel@tonic-gate 2107c478bd9Sstevel@tonic-gate /* 2117c478bd9Sstevel@tonic-gate * Handles minor node type "ddi_display". 2127c478bd9Sstevel@tonic-gate * 2137c478bd9Sstevel@tonic-gate * type=ddi_display fbs/\M0 fb\N0 2147c478bd9Sstevel@tonic-gate */ 2157c478bd9Sstevel@tonic-gate static int 2167c478bd9Sstevel@tonic-gate display(di_minor_t minor, di_node_t node) 2177c478bd9Sstevel@tonic-gate { 2187c478bd9Sstevel@tonic-gate char l_path[PATH_MAX + 1], contents[PATH_MAX + 1], *buf; 2197c478bd9Sstevel@tonic-gate devfsadm_enumerate_t rules[1] = {"^fb([0-9]+)$", 1, MATCH_ALL}; 2207c478bd9Sstevel@tonic-gate char *mn = di_minor_name(minor); 2217c478bd9Sstevel@tonic-gate 2227c478bd9Sstevel@tonic-gate /* create fbs/\M0 primary link */ 2237c478bd9Sstevel@tonic-gate (void) strcpy(l_path, "fbs/"); 2247c478bd9Sstevel@tonic-gate (void) strcat(l_path, mn); 2257c478bd9Sstevel@tonic-gate (void) devfsadm_mklink(l_path, node, minor, 0); 2267c478bd9Sstevel@tonic-gate 2277c478bd9Sstevel@tonic-gate /* create fb\N0 which links to fbs/\M0 */ 2287c478bd9Sstevel@tonic-gate if (devfsadm_enumerate_int(l_path, 0, &buf, rules, 1)) { 2297c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 2307c478bd9Sstevel@tonic-gate } 2317c478bd9Sstevel@tonic-gate (void) strcpy(contents, l_path); 2327c478bd9Sstevel@tonic-gate (void) strcpy(l_path, "fb"); 2337c478bd9Sstevel@tonic-gate (void) strcat(l_path, buf); 2347c478bd9Sstevel@tonic-gate free(buf); 2357c478bd9Sstevel@tonic-gate (void) devfsadm_secondary_link(l_path, contents, 0); 2367c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 2377c478bd9Sstevel@tonic-gate } 2387c478bd9Sstevel@tonic-gate 2397c478bd9Sstevel@tonic-gate /* 2407c478bd9Sstevel@tonic-gate * Handles minor node type "ddi_parallel". 2417c478bd9Sstevel@tonic-gate * type=ddi_parallel;name=mcpp mcpp\N0 2427c478bd9Sstevel@tonic-gate */ 2437c478bd9Sstevel@tonic-gate static int 2447c478bd9Sstevel@tonic-gate parallel(di_minor_t minor, di_node_t node) 2457c478bd9Sstevel@tonic-gate { 2467c478bd9Sstevel@tonic-gate char path[PATH_MAX + 1], *buf; 2477c478bd9Sstevel@tonic-gate devfsadm_enumerate_t rules[1] = {"mcpp([0-9]+)$", 1, MATCH_ALL}; 2487c478bd9Sstevel@tonic-gate 2497c478bd9Sstevel@tonic-gate 2507c478bd9Sstevel@tonic-gate if (strcmp(di_node_name(node), "mcpp") != 0) { 2517c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 2527c478bd9Sstevel@tonic-gate } 2537c478bd9Sstevel@tonic-gate 2547c478bd9Sstevel@tonic-gate if (NULL == (buf = di_devfs_path(node))) { 2557c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 2567c478bd9Sstevel@tonic-gate } 2577c478bd9Sstevel@tonic-gate 2587c478bd9Sstevel@tonic-gate (void) snprintf(path, sizeof (path), "%s:%s", 2597c478bd9Sstevel@tonic-gate buf, di_minor_name(minor)); 2607c478bd9Sstevel@tonic-gate 2617c478bd9Sstevel@tonic-gate di_devfs_path_free(buf); 2627c478bd9Sstevel@tonic-gate 2637c478bd9Sstevel@tonic-gate if (devfsadm_enumerate_int(path, 0, &buf, rules, 1)) { 2647c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 2657c478bd9Sstevel@tonic-gate } 2667c478bd9Sstevel@tonic-gate (void) snprintf(path, sizeof (path), "mcpp%s", buf); 2677c478bd9Sstevel@tonic-gate free(buf); 2687c478bd9Sstevel@tonic-gate 2697c478bd9Sstevel@tonic-gate (void) devfsadm_mklink(path, node, minor, 0); 2707c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 2717c478bd9Sstevel@tonic-gate } 2727c478bd9Sstevel@tonic-gate 2737c478bd9Sstevel@tonic-gate static int 2747c478bd9Sstevel@tonic-gate ses_callback(di_minor_t minor, di_node_t node) 2757c478bd9Sstevel@tonic-gate { 2767c478bd9Sstevel@tonic-gate char l_path[PATH_MAX]; 2777c478bd9Sstevel@tonic-gate char *buf; 2787c478bd9Sstevel@tonic-gate char *devfspath; 2797c478bd9Sstevel@tonic-gate char p_path[PATH_MAX]; 2807c478bd9Sstevel@tonic-gate devfsadm_enumerate_t re[] = {"^es$/^ses([0-9]+)$", 1, MATCH_ALL}; 2817c478bd9Sstevel@tonic-gate 2827c478bd9Sstevel@tonic-gate /* find devices path -- need to free mem */ 2837c478bd9Sstevel@tonic-gate if (NULL == (devfspath = di_devfs_path(node))) { 2847c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 2857c478bd9Sstevel@tonic-gate } 2867c478bd9Sstevel@tonic-gate 2877c478bd9Sstevel@tonic-gate (void) snprintf(p_path, sizeof (p_path), "%s:%s", devfspath, 2887c478bd9Sstevel@tonic-gate di_minor_name(minor)); 2897c478bd9Sstevel@tonic-gate 2907c478bd9Sstevel@tonic-gate 2917c478bd9Sstevel@tonic-gate /* find next number to use; buf is an ascii number */ 2927c478bd9Sstevel@tonic-gate if (devfsadm_enumerate_int(p_path, 0, &buf, re, 1)) { 2937c478bd9Sstevel@tonic-gate /* free memory */ 2947c478bd9Sstevel@tonic-gate di_devfs_path_free(devfspath); 2957c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 2967c478bd9Sstevel@tonic-gate } 2977c478bd9Sstevel@tonic-gate 2987c478bd9Sstevel@tonic-gate (void) snprintf(l_path, sizeof (l_path), "es/ses%s", buf); 2997c478bd9Sstevel@tonic-gate 3007c478bd9Sstevel@tonic-gate (void) devfsadm_mklink(l_path, node, minor, 0); 3017c478bd9Sstevel@tonic-gate /* free memory */ 3027c478bd9Sstevel@tonic-gate free(buf); 3037c478bd9Sstevel@tonic-gate di_devfs_path_free(devfspath); 3047c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 3057c478bd9Sstevel@tonic-gate 3067c478bd9Sstevel@tonic-gate } 3077c478bd9Sstevel@tonic-gate 3087c478bd9Sstevel@tonic-gate static int 3097c478bd9Sstevel@tonic-gate node_slash_minor(di_minor_t minor, di_node_t node) 3107c478bd9Sstevel@tonic-gate { 3117c478bd9Sstevel@tonic-gate 3127c478bd9Sstevel@tonic-gate char path[PATH_MAX + 1]; 3137c478bd9Sstevel@tonic-gate 3147c478bd9Sstevel@tonic-gate (void) strcpy(path, di_node_name(node)); 3157c478bd9Sstevel@tonic-gate (void) strcat(path, "/"); 3167c478bd9Sstevel@tonic-gate (void) strcat(path, di_minor_name(minor)); 3177c478bd9Sstevel@tonic-gate (void) devfsadm_mklink(path, node, minor, 0); 3187c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 3197c478bd9Sstevel@tonic-gate } 3207c478bd9Sstevel@tonic-gate 3217c478bd9Sstevel@tonic-gate static int 3227c478bd9Sstevel@tonic-gate driver_minor(di_minor_t minor, di_node_t node) 3237c478bd9Sstevel@tonic-gate { 3247c478bd9Sstevel@tonic-gate char path[PATH_MAX + 1]; 3257c478bd9Sstevel@tonic-gate 3267c478bd9Sstevel@tonic-gate (void) strcpy(path, di_driver_name(node)); 3277c478bd9Sstevel@tonic-gate (void) strcat(path, di_minor_name(minor)); 3287c478bd9Sstevel@tonic-gate (void) devfsadm_mklink(path, node, minor, 0); 3297c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 3307c478bd9Sstevel@tonic-gate } 3317c478bd9Sstevel@tonic-gate 3327c478bd9Sstevel@tonic-gate /* 3337c478bd9Sstevel@tonic-gate * Handles links of the form: 3347c478bd9Sstevel@tonic-gate * type=ddi_pseudo;name=xyz \D 3357c478bd9Sstevel@tonic-gate */ 3367c478bd9Sstevel@tonic-gate static int 3377c478bd9Sstevel@tonic-gate node_name(di_minor_t minor, di_node_t node) 3387c478bd9Sstevel@tonic-gate { 3397c478bd9Sstevel@tonic-gate (void) devfsadm_mklink(di_node_name(node), node, minor, 0); 3407c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 3417c478bd9Sstevel@tonic-gate } 3427c478bd9Sstevel@tonic-gate 3437c478bd9Sstevel@tonic-gate /* 3447c478bd9Sstevel@tonic-gate * Handles links of the form: 3457c478bd9Sstevel@tonic-gate * type=ddi_pseudo;name=xyz \M0 3467c478bd9Sstevel@tonic-gate */ 3477c478bd9Sstevel@tonic-gate static int 3487c478bd9Sstevel@tonic-gate minor_name(di_minor_t minor, di_node_t node) 3497c478bd9Sstevel@tonic-gate { 3507c478bd9Sstevel@tonic-gate char *mn = di_minor_name(minor); 3517c478bd9Sstevel@tonic-gate 3527c478bd9Sstevel@tonic-gate (void) devfsadm_mklink(mn, node, minor, 0); 3537c478bd9Sstevel@tonic-gate if (strcmp(mn, "icmp") == 0) { 3547c478bd9Sstevel@tonic-gate (void) devfsadm_mklink("rawip", node, minor, 0); 3557c478bd9Sstevel@tonic-gate } 3567c478bd9Sstevel@tonic-gate if (strcmp(mn, "icmp6") == 0) { 3577c478bd9Sstevel@tonic-gate (void) devfsadm_mklink("rawip6", node, minor, 0); 3587c478bd9Sstevel@tonic-gate } 3597c478bd9Sstevel@tonic-gate if (strcmp(mn, "ipf") == 0) { 3607c478bd9Sstevel@tonic-gate (void) devfsadm_mklink("ipl", node, minor, 0); 3617c478bd9Sstevel@tonic-gate } 3627c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 3637c478bd9Sstevel@tonic-gate } 3647c478bd9Sstevel@tonic-gate 365*516fc7f3Shx147065 /* 366*516fc7f3Shx147065 * create links at /dev/wifi for wifi minor node 367*516fc7f3Shx147065 */ 368*516fc7f3Shx147065 static int 369*516fc7f3Shx147065 wifi_minor_name(di_minor_t minor, di_node_t node) 370*516fc7f3Shx147065 { 371*516fc7f3Shx147065 char buf[256]; 372*516fc7f3Shx147065 char *mn = di_minor_name(minor); 373*516fc7f3Shx147065 374*516fc7f3Shx147065 (void) snprintf(buf, sizeof (buf), "%s%s", "wifi/", mn); 375*516fc7f3Shx147065 (void) devfsadm_mklink(buf, node, minor, 0); 376*516fc7f3Shx147065 377*516fc7f3Shx147065 return (DEVFSADM_CONTINUE); 378*516fc7f3Shx147065 } 3797c478bd9Sstevel@tonic-gate 3807c478bd9Sstevel@tonic-gate static int 3817c478bd9Sstevel@tonic-gate conskbd(di_minor_t minor, di_node_t node) 3827c478bd9Sstevel@tonic-gate { 3837c478bd9Sstevel@tonic-gate (void) devfsadm_mklink("kbd", node, minor, 0); 3847c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 3857c478bd9Sstevel@tonic-gate } 3867c478bd9Sstevel@tonic-gate 3877c478bd9Sstevel@tonic-gate static int 3887c478bd9Sstevel@tonic-gate consms(di_minor_t minor, di_node_t node) 3897c478bd9Sstevel@tonic-gate { 3907c478bd9Sstevel@tonic-gate (void) devfsadm_mklink("mouse", node, minor, 0); 3917c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 3927c478bd9Sstevel@tonic-gate } 3937c478bd9Sstevel@tonic-gate 3947c478bd9Sstevel@tonic-gate static int 3957c478bd9Sstevel@tonic-gate power_button(di_minor_t minor, di_node_t node) 3967c478bd9Sstevel@tonic-gate { 3977c478bd9Sstevel@tonic-gate (void) devfsadm_mklink("power_button", node, minor, 0); 3987c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 3997c478bd9Sstevel@tonic-gate } 4007c478bd9Sstevel@tonic-gate 4017c478bd9Sstevel@tonic-gate static int 4027c478bd9Sstevel@tonic-gate fc_port(di_minor_t minor, di_node_t node) 4037c478bd9Sstevel@tonic-gate { 4047c478bd9Sstevel@tonic-gate devfsadm_enumerate_t rules[1] = {"fc/fp([0-9]+)$", 1, MATCH_ALL}; 4057c478bd9Sstevel@tonic-gate char *buf, path[PATH_MAX + 1]; 4067c478bd9Sstevel@tonic-gate char *ptr; 4077c478bd9Sstevel@tonic-gate 4087c478bd9Sstevel@tonic-gate if (NULL == (ptr = di_devfs_path(node))) { 4097c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 4107c478bd9Sstevel@tonic-gate } 4117c478bd9Sstevel@tonic-gate 4127c478bd9Sstevel@tonic-gate (void) strcpy(path, ptr); 4137c478bd9Sstevel@tonic-gate (void) strcat(path, ":"); 4147c478bd9Sstevel@tonic-gate (void) strcat(path, di_minor_name(minor)); 4157c478bd9Sstevel@tonic-gate 4167c478bd9Sstevel@tonic-gate di_devfs_path_free(ptr); 4177c478bd9Sstevel@tonic-gate 4187c478bd9Sstevel@tonic-gate if (devfsadm_enumerate_int(path, 0, &buf, rules, 1) != 0) { 4197c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 4207c478bd9Sstevel@tonic-gate } 4217c478bd9Sstevel@tonic-gate 4227c478bd9Sstevel@tonic-gate (void) strcpy(path, "fc/fp"); 4237c478bd9Sstevel@tonic-gate (void) strcat(path, buf); 4247c478bd9Sstevel@tonic-gate free(buf); 4257c478bd9Sstevel@tonic-gate 4267c478bd9Sstevel@tonic-gate (void) devfsadm_mklink(path, node, minor, 0); 4277c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 4287c478bd9Sstevel@tonic-gate } 4297c478bd9Sstevel@tonic-gate 4307c478bd9Sstevel@tonic-gate /* 4317c478bd9Sstevel@tonic-gate * Handles: 4327c478bd9Sstevel@tonic-gate * minor node type "ddi_printer". 4337c478bd9Sstevel@tonic-gate * rules of the form: type=ddi_printer;name=bpp \M0 4347c478bd9Sstevel@tonic-gate */ 4357c478bd9Sstevel@tonic-gate static int 4367c478bd9Sstevel@tonic-gate printer_create(di_minor_t minor, di_node_t node) 4377c478bd9Sstevel@tonic-gate { 4387c478bd9Sstevel@tonic-gate char *mn; 4397c478bd9Sstevel@tonic-gate char path[PATH_MAX + 1], *buf; 4407c478bd9Sstevel@tonic-gate devfsadm_enumerate_t rules[1] = {"^printers$/^([0-9]+)$", 1, MATCH_ALL}; 4417c478bd9Sstevel@tonic-gate 4427c478bd9Sstevel@tonic-gate mn = di_minor_name(minor); 4437c478bd9Sstevel@tonic-gate 4447c478bd9Sstevel@tonic-gate if (strcmp(di_driver_name(node), "bpp") == 0) { 4457c478bd9Sstevel@tonic-gate (void) devfsadm_mklink(mn, node, minor, 0); 4467c478bd9Sstevel@tonic-gate } 4477c478bd9Sstevel@tonic-gate 4487c478bd9Sstevel@tonic-gate if (NULL == (buf = di_devfs_path(node))) { 4497c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 4507c478bd9Sstevel@tonic-gate } 4517c478bd9Sstevel@tonic-gate 4527c478bd9Sstevel@tonic-gate (void) snprintf(path, sizeof (path), "%s:%s", buf, mn); 4537c478bd9Sstevel@tonic-gate di_devfs_path_free(buf); 4547c478bd9Sstevel@tonic-gate 4557c478bd9Sstevel@tonic-gate if (devfsadm_enumerate_int(path, 0, &buf, rules, 1)) { 4567c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 4577c478bd9Sstevel@tonic-gate } 4587c478bd9Sstevel@tonic-gate 4597c478bd9Sstevel@tonic-gate (void) snprintf(path, sizeof (path), "printers/%s", buf); 4607c478bd9Sstevel@tonic-gate free(buf); 4617c478bd9Sstevel@tonic-gate 4627c478bd9Sstevel@tonic-gate (void) devfsadm_mklink(path, node, minor, 0); 4637c478bd9Sstevel@tonic-gate 4647c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 4657c478bd9Sstevel@tonic-gate } 4667c478bd9Sstevel@tonic-gate 4677c478bd9Sstevel@tonic-gate /* 4687c478bd9Sstevel@tonic-gate * Handles links of the form: 4697c478bd9Sstevel@tonic-gate * type=ddi_pseudo;name=se;minor2=hdlc se_hdlc\N0 4707c478bd9Sstevel@tonic-gate * type=ddi_pseudo;name=serial;minor2=hdlc se_hdlc\N0 4717c478bd9Sstevel@tonic-gate */ 4727c478bd9Sstevel@tonic-gate static int 4737c478bd9Sstevel@tonic-gate se_hdlc_create(di_minor_t minor, di_node_t node) 4747c478bd9Sstevel@tonic-gate { 4757c478bd9Sstevel@tonic-gate devfsadm_enumerate_t rules[1] = {"^se_hdlc([0-9]+)$", 1, MATCH_ALL}; 4767c478bd9Sstevel@tonic-gate char *buf, path[PATH_MAX + 1]; 4777c478bd9Sstevel@tonic-gate char *ptr; 4787c478bd9Sstevel@tonic-gate char *mn; 4797c478bd9Sstevel@tonic-gate 4807c478bd9Sstevel@tonic-gate mn = di_minor_name(minor); 4817c478bd9Sstevel@tonic-gate 4827c478bd9Sstevel@tonic-gate /* minor node should be of the form: "?,hdlc" */ 4837c478bd9Sstevel@tonic-gate if (strcmp(mn + 1, ",hdlc") != 0) { 4847c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 4857c478bd9Sstevel@tonic-gate } 4867c478bd9Sstevel@tonic-gate 4877c478bd9Sstevel@tonic-gate if (NULL == (ptr = di_devfs_path(node))) { 4887c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 4897c478bd9Sstevel@tonic-gate } 4907c478bd9Sstevel@tonic-gate 4917c478bd9Sstevel@tonic-gate (void) strcpy(path, ptr); 4927c478bd9Sstevel@tonic-gate (void) strcat(path, ":"); 4937c478bd9Sstevel@tonic-gate (void) strcat(path, mn); 4947c478bd9Sstevel@tonic-gate 4957c478bd9Sstevel@tonic-gate di_devfs_path_free(ptr); 4967c478bd9Sstevel@tonic-gate 4977c478bd9Sstevel@tonic-gate if (devfsadm_enumerate_int(path, 0, &buf, rules, 1) != 0) { 4987c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 4997c478bd9Sstevel@tonic-gate } 5007c478bd9Sstevel@tonic-gate 5017c478bd9Sstevel@tonic-gate (void) strcpy(path, "se_hdlc"); 5027c478bd9Sstevel@tonic-gate (void) strcat(path, buf); 5037c478bd9Sstevel@tonic-gate free(buf); 5047c478bd9Sstevel@tonic-gate 5057c478bd9Sstevel@tonic-gate (void) devfsadm_mklink(path, node, minor, 0); 5067c478bd9Sstevel@tonic-gate 5077c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 5087c478bd9Sstevel@tonic-gate } 5097c478bd9Sstevel@tonic-gate 5107c478bd9Sstevel@tonic-gate static int 5117c478bd9Sstevel@tonic-gate gpio(di_minor_t minor, di_node_t node) 5127c478bd9Sstevel@tonic-gate { 5137c478bd9Sstevel@tonic-gate char l_path[PATH_MAX], p_path[PATH_MAX], *buf, *devfspath; 5147c478bd9Sstevel@tonic-gate char *minor_nm, *drvr_nm; 5157c478bd9Sstevel@tonic-gate 5167c478bd9Sstevel@tonic-gate 5177c478bd9Sstevel@tonic-gate minor_nm = di_minor_name(minor); 5187c478bd9Sstevel@tonic-gate drvr_nm = di_driver_name(node); 5197c478bd9Sstevel@tonic-gate if ((minor_nm == NULL) || (drvr_nm == NULL)) { 5207c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 5217c478bd9Sstevel@tonic-gate } 5227c478bd9Sstevel@tonic-gate 5237c478bd9Sstevel@tonic-gate devfspath = di_devfs_path(node); 5247c478bd9Sstevel@tonic-gate 5257c478bd9Sstevel@tonic-gate (void) strcpy(p_path, devfspath); 5267c478bd9Sstevel@tonic-gate (void) strcat(p_path, ":"); 5277c478bd9Sstevel@tonic-gate (void) strcat(p_path, minor_nm); 5287c478bd9Sstevel@tonic-gate di_devfs_path_free(devfspath); 5297c478bd9Sstevel@tonic-gate 5307c478bd9Sstevel@tonic-gate /* build the physical path from the components */ 5317c478bd9Sstevel@tonic-gate if (devfsadm_enumerate_int(p_path, 0, &buf, gpio_rules, 1)) { 5327c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 5337c478bd9Sstevel@tonic-gate } 5347c478bd9Sstevel@tonic-gate 5357c478bd9Sstevel@tonic-gate (void) snprintf(l_path, sizeof (l_path), "%s%s", "gpio", buf); 5367c478bd9Sstevel@tonic-gate 5377c478bd9Sstevel@tonic-gate free(buf); 5387c478bd9Sstevel@tonic-gate 5397c478bd9Sstevel@tonic-gate (void) devfsadm_mklink(l_path, node, minor, 0); 5407c478bd9Sstevel@tonic-gate 5417c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 5427c478bd9Sstevel@tonic-gate } 5437c478bd9Sstevel@tonic-gate 5447c478bd9Sstevel@tonic-gate /* 5457c478bd9Sstevel@tonic-gate * Creates /dev/ppm nodes for Platform Specific PM module 5467c478bd9Sstevel@tonic-gate */ 5477c478bd9Sstevel@tonic-gate static int 5487c478bd9Sstevel@tonic-gate ppm(di_minor_t minor, di_node_t node) 5497c478bd9Sstevel@tonic-gate { 5507c478bd9Sstevel@tonic-gate (void) devfsadm_mklink("ppm", node, minor, 0); 5517c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 5527c478bd9Sstevel@tonic-gate } 5537c478bd9Sstevel@tonic-gate 5547c478bd9Sstevel@tonic-gate /* 5557c478bd9Sstevel@tonic-gate * Handles: 5567c478bd9Sstevel@tonic-gate * /dev/av/[0-9]+/(async|isoch) 5577c478bd9Sstevel@tonic-gate */ 5587c478bd9Sstevel@tonic-gate static int 5597c478bd9Sstevel@tonic-gate av_create(di_minor_t minor, di_node_t node) 5607c478bd9Sstevel@tonic-gate { 5617c478bd9Sstevel@tonic-gate devfsadm_enumerate_t rules[1] = {"^av$/^([0-9]+)$", 1, MATCH_ADDR}; 5627c478bd9Sstevel@tonic-gate char *minor_str; 5637c478bd9Sstevel@tonic-gate char path[PATH_MAX + 1]; 5647c478bd9Sstevel@tonic-gate char *buf; 5657c478bd9Sstevel@tonic-gate 5667c478bd9Sstevel@tonic-gate if ((buf = di_devfs_path(node)) == NULL) { 5677c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 5687c478bd9Sstevel@tonic-gate } 5697c478bd9Sstevel@tonic-gate 5707c478bd9Sstevel@tonic-gate minor_str = di_minor_name(minor); 5717c478bd9Sstevel@tonic-gate (void) snprintf(path, sizeof (path), "%s:%s", buf, minor_str); 5727c478bd9Sstevel@tonic-gate di_devfs_path_free(buf); 5737c478bd9Sstevel@tonic-gate 5747c478bd9Sstevel@tonic-gate if (devfsadm_enumerate_int(path, 0, &buf, rules, 1)) { 5757c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 5767c478bd9Sstevel@tonic-gate } 5777c478bd9Sstevel@tonic-gate 5787c478bd9Sstevel@tonic-gate (void) snprintf(path, sizeof (path), "av/%s/%s", buf, minor_str); 5797c478bd9Sstevel@tonic-gate free(buf); 5807c478bd9Sstevel@tonic-gate 5817c478bd9Sstevel@tonic-gate (void) devfsadm_mklink(path, node, minor, 0); 5827c478bd9Sstevel@tonic-gate 5837c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 5847c478bd9Sstevel@tonic-gate } 5857c478bd9Sstevel@tonic-gate 5867c478bd9Sstevel@tonic-gate /* 5877c478bd9Sstevel@tonic-gate * Creates /dev/lom and /dev/tsalarm:ctl for tsalarm node 5887c478bd9Sstevel@tonic-gate */ 5897c478bd9Sstevel@tonic-gate static int 5907c478bd9Sstevel@tonic-gate tsalarm_create(di_minor_t minor, di_node_t node) 5917c478bd9Sstevel@tonic-gate { 5927c478bd9Sstevel@tonic-gate char buf[PATH_MAX + 1]; 5937c478bd9Sstevel@tonic-gate char *mn = di_minor_name(minor); 5947c478bd9Sstevel@tonic-gate 5957c478bd9Sstevel@tonic-gate (void) snprintf(buf, sizeof (buf), "%s%s", di_node_name(node), ":ctl"); 5967c478bd9Sstevel@tonic-gate 5977c478bd9Sstevel@tonic-gate (void) devfsadm_mklink(mn, node, minor, 0); 5987c478bd9Sstevel@tonic-gate (void) devfsadm_mklink(buf, node, minor, 0); 5997c478bd9Sstevel@tonic-gate 6007c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 6017c478bd9Sstevel@tonic-gate } 6027c478bd9Sstevel@tonic-gate 603e3f8e17dSsc121708 /* 604e3f8e17dSsc121708 * Creates /dev/ntwdt for ntwdt node 605e3f8e17dSsc121708 */ 606e3f8e17dSsc121708 static int 607e3f8e17dSsc121708 ntwdt_create(di_minor_t minor, di_node_t node) 608e3f8e17dSsc121708 { 609e3f8e17dSsc121708 (void) devfsadm_mklink("ntwdt", node, minor, 0); 610e3f8e17dSsc121708 return (DEVFSADM_CONTINUE); 611e3f8e17dSsc121708 } 612e3f8e17dSsc121708 6137c478bd9Sstevel@tonic-gate static int 6147c478bd9Sstevel@tonic-gate zcons_create(di_minor_t minor, di_node_t node) 6157c478bd9Sstevel@tonic-gate { 6167c478bd9Sstevel@tonic-gate char *minor_str; 6177c478bd9Sstevel@tonic-gate char *zonename; 6187c478bd9Sstevel@tonic-gate char path[MAXPATHLEN]; 6197c478bd9Sstevel@tonic-gate 6207c478bd9Sstevel@tonic-gate minor_str = di_minor_name(minor); 6217c478bd9Sstevel@tonic-gate 6227c478bd9Sstevel@tonic-gate if (di_prop_lookup_strings(DDI_DEV_T_ANY, node, "zonename", 6237c478bd9Sstevel@tonic-gate &zonename) == -1) { 6247c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 6257c478bd9Sstevel@tonic-gate } 6267c478bd9Sstevel@tonic-gate 6277c478bd9Sstevel@tonic-gate (void) snprintf(path, sizeof (path), "zcons/%s/%s", zonename, 6287c478bd9Sstevel@tonic-gate minor_str); 6297c478bd9Sstevel@tonic-gate (void) devfsadm_mklink(path, node, minor, 0); 6307c478bd9Sstevel@tonic-gate 6317c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 6327c478bd9Sstevel@tonic-gate } 6337c478bd9Sstevel@tonic-gate 6347c478bd9Sstevel@tonic-gate /* 6357c478bd9Sstevel@tonic-gate * /dev/cpu/self/cpuid -> /devices/pseudo/cpuid@0:self 6367c478bd9Sstevel@tonic-gate */ 6377c478bd9Sstevel@tonic-gate static int 6387c478bd9Sstevel@tonic-gate cpuid(di_minor_t minor, di_node_t node) 6397c478bd9Sstevel@tonic-gate { 6407c478bd9Sstevel@tonic-gate (void) devfsadm_mklink(CPUID_SELF_NAME, node, minor, 0); 6417c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 6427c478bd9Sstevel@tonic-gate } 6437c478bd9Sstevel@tonic-gate 6447c478bd9Sstevel@tonic-gate /* 6457c478bd9Sstevel@tonic-gate * For device 6467c478bd9Sstevel@tonic-gate * /dev/spfma -> /devices/virtual-devices/fma@5:glvc 6477c478bd9Sstevel@tonic-gate */ 6487c478bd9Sstevel@tonic-gate static int 6497c478bd9Sstevel@tonic-gate glvc(di_minor_t minor, di_node_t node) 6507c478bd9Sstevel@tonic-gate { 6517c478bd9Sstevel@tonic-gate char node_name[MAXNAMELEN + 1]; 6527c478bd9Sstevel@tonic-gate 6537c478bd9Sstevel@tonic-gate (void) strcpy(node_name, di_node_name(node)); 6547c478bd9Sstevel@tonic-gate 6557c478bd9Sstevel@tonic-gate if (strncmp(node_name, "fma", 3) == 0) { 6567c478bd9Sstevel@tonic-gate /* Only one fma channel */ 6577c478bd9Sstevel@tonic-gate (void) devfsadm_mklink("spfma", node, minor, 0); 6587c478bd9Sstevel@tonic-gate } 6597c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 6607c478bd9Sstevel@tonic-gate } 661