10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 50Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 60Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 70Sstevel@tonic-gate * with the License. 80Sstevel@tonic-gate * 90Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 100Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 110Sstevel@tonic-gate * See the License for the specific language governing permissions 120Sstevel@tonic-gate * and limitations under the License. 130Sstevel@tonic-gate * 140Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 150Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 160Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 170Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 180Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 190Sstevel@tonic-gate * 200Sstevel@tonic-gate * CDDL HEADER END 210Sstevel@tonic-gate */ 220Sstevel@tonic-gate /* 230Sstevel@tonic-gate * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 240Sstevel@tonic-gate * Use is subject to license terms. 250Sstevel@tonic-gate */ 260Sstevel@tonic-gate 270Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 280Sstevel@tonic-gate 290Sstevel@tonic-gate #include <regex.h> 300Sstevel@tonic-gate #include <devfsadm.h> 310Sstevel@tonic-gate #include <stdio.h> 320Sstevel@tonic-gate #include <strings.h> 330Sstevel@tonic-gate #include <stdlib.h> 340Sstevel@tonic-gate #include <limits.h> 350Sstevel@tonic-gate #include <ctype.h> 360Sstevel@tonic-gate 370Sstevel@tonic-gate static int lp(di_minor_t minor, di_node_t node); 380Sstevel@tonic-gate static int serial_dialout(di_minor_t minor, di_node_t node); 390Sstevel@tonic-gate static int serial(di_minor_t minor, di_node_t node); 400Sstevel@tonic-gate static int diskette(di_minor_t minor, di_node_t node); 410Sstevel@tonic-gate static int vt00(di_minor_t minor, di_node_t node); 420Sstevel@tonic-gate static int kdmouse(di_minor_t minor, di_node_t node); 430Sstevel@tonic-gate static int bmc(di_minor_t minor, di_node_t node); 44*437Smws static int smbios(di_minor_t minor, di_node_t node); 450Sstevel@tonic-gate static int agp_process(di_minor_t minor, di_node_t node); 460Sstevel@tonic-gate 470Sstevel@tonic-gate static devfsadm_create_t misc_cbt[] = { 480Sstevel@tonic-gate { "vt00", "ddi_display", NULL, 490Sstevel@tonic-gate TYPE_EXACT, ILEVEL_0, vt00 500Sstevel@tonic-gate }, 510Sstevel@tonic-gate { "mouse", "ddi_mouse", "mouse8042", 520Sstevel@tonic-gate TYPE_EXACT | DRV_EXACT, ILEVEL_0, kdmouse 530Sstevel@tonic-gate }, 540Sstevel@tonic-gate { "pseudo", "ddi_pseudo", "bmc", 550Sstevel@tonic-gate TYPE_EXACT | DRV_EXACT, ILEVEL_0, bmc, 560Sstevel@tonic-gate }, 57*437Smws { "pseudo", "ddi_pseudo", "smbios", 58*437Smws TYPE_EXACT | DRV_EXACT, ILEVEL_1, smbios, 59*437Smws }, 600Sstevel@tonic-gate { "disk", "ddi_block:diskette", NULL, 610Sstevel@tonic-gate TYPE_EXACT, ILEVEL_1, diskette 620Sstevel@tonic-gate }, 630Sstevel@tonic-gate { "parallel", "ddi_printer", NULL, 640Sstevel@tonic-gate TYPE_EXACT, ILEVEL_1, lp 650Sstevel@tonic-gate }, 660Sstevel@tonic-gate { "serial", "ddi_serial:mb", NULL, 670Sstevel@tonic-gate TYPE_EXACT, ILEVEL_1, serial 680Sstevel@tonic-gate }, 690Sstevel@tonic-gate { "serial", "ddi_serial:dialout,mb", NULL, 700Sstevel@tonic-gate TYPE_EXACT, ILEVEL_1, serial_dialout 710Sstevel@tonic-gate }, 720Sstevel@tonic-gate {"agp", "ddi_agp:pseudo", NULL, 730Sstevel@tonic-gate TYPE_EXACT, ILEVEL_0, agp_process 740Sstevel@tonic-gate }, 750Sstevel@tonic-gate {"agp", "ddi_agp:target", NULL, 760Sstevel@tonic-gate TYPE_EXACT, ILEVEL_0, agp_process 770Sstevel@tonic-gate }, 780Sstevel@tonic-gate {"agp", "ddi_agp:cpugart", NULL, 790Sstevel@tonic-gate TYPE_EXACT, ILEVEL_0, agp_process 800Sstevel@tonic-gate }, 810Sstevel@tonic-gate {"agp", "ddi_agp:master", NULL, 820Sstevel@tonic-gate TYPE_EXACT, ILEVEL_0, agp_process 830Sstevel@tonic-gate } 840Sstevel@tonic-gate }; 850Sstevel@tonic-gate 860Sstevel@tonic-gate DEVFSADM_CREATE_INIT_V0(misc_cbt); 870Sstevel@tonic-gate 880Sstevel@tonic-gate static char *debug_mid = "agp_mid"; 890Sstevel@tonic-gate 900Sstevel@tonic-gate typedef enum { 910Sstevel@tonic-gate DRIVER_AGPPSEUDO = 0, 920Sstevel@tonic-gate DRIVER_AGPTARGET, 930Sstevel@tonic-gate DRIVER_CPUGART, 940Sstevel@tonic-gate DRIVER_AGPMASTER, 950Sstevel@tonic-gate DRIVER_UNKNOWN 960Sstevel@tonic-gate } driver_defs_t; 970Sstevel@tonic-gate 980Sstevel@tonic-gate typedef struct { 990Sstevel@tonic-gate char *driver_name; 1000Sstevel@tonic-gate int index; 1010Sstevel@tonic-gate } driver_name_table_entry_t; 1020Sstevel@tonic-gate 1030Sstevel@tonic-gate static driver_name_table_entry_t driver_name_table[] = { 1040Sstevel@tonic-gate { "agpgart", DRIVER_AGPPSEUDO }, 1050Sstevel@tonic-gate { "agptarget", DRIVER_AGPTARGET }, 1060Sstevel@tonic-gate { "amd64_gart", DRIVER_CPUGART }, 1070Sstevel@tonic-gate { "vgatext", DRIVER_AGPMASTER }, 1080Sstevel@tonic-gate { NULL, DRIVER_UNKNOWN } 1090Sstevel@tonic-gate }; 1100Sstevel@tonic-gate 1110Sstevel@tonic-gate static devfsadm_enumerate_t agptarget_rules[1] = 1120Sstevel@tonic-gate { "^agp$/^agptarget([0-9]+)$", 1, MATCH_ALL }; 1130Sstevel@tonic-gate static devfsadm_enumerate_t cpugart_rules[1] = 1140Sstevel@tonic-gate { "^agp$/^cpugart([0-9]+)$", 1, MATCH_ALL }; 1150Sstevel@tonic-gate static devfsadm_enumerate_t agpmaster_rules[1] = 1160Sstevel@tonic-gate { "^agp$/^agpmaster([0-9]+)$", 1, MATCH_ALL }; 1170Sstevel@tonic-gate 1180Sstevel@tonic-gate static devfsadm_remove_t misc_remove_cbt[] = { 1190Sstevel@tonic-gate { "vt", "vt[0-9][0-9]", RM_PRE|RM_ALWAYS, 1200Sstevel@tonic-gate ILEVEL_0, devfsadm_rm_all 1210Sstevel@tonic-gate } 1220Sstevel@tonic-gate }; 1230Sstevel@tonic-gate 1240Sstevel@tonic-gate DEVFSADM_REMOVE_INIT_V0(misc_remove_cbt); 1250Sstevel@tonic-gate 1260Sstevel@tonic-gate /* 1270Sstevel@tonic-gate * Handles minor node type "ddi_display", in addition to generic processing 1280Sstevel@tonic-gate * done by display(). 1290Sstevel@tonic-gate * 1300Sstevel@tonic-gate * This creates a /dev/vt00 link to /dev/fb, for backwards compatibility. 1310Sstevel@tonic-gate */ 1320Sstevel@tonic-gate /* ARGSUSED */ 1330Sstevel@tonic-gate int 1340Sstevel@tonic-gate vt00(di_minor_t minor, di_node_t node) 1350Sstevel@tonic-gate { 1360Sstevel@tonic-gate (void) devfsadm_secondary_link("vt00", "fb", 0); 1370Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 1380Sstevel@tonic-gate } 1390Sstevel@tonic-gate 1400Sstevel@tonic-gate /* 1410Sstevel@tonic-gate * type=ddi_block:diskette;addr=0,0;minor=c diskette 1420Sstevel@tonic-gate * type=ddi_block:diskette;addr=0,0;minor=c,raw rdiskette 1430Sstevel@tonic-gate * type=ddi_block:diskette;addr1=0;minor=c diskette\A2 1440Sstevel@tonic-gate * type=ddi_block:diskette;addr1=0;minor=c,raw rdiskette\A2 1450Sstevel@tonic-gate */ 1460Sstevel@tonic-gate static int 1470Sstevel@tonic-gate diskette(di_minor_t minor, di_node_t node) 1480Sstevel@tonic-gate { 1490Sstevel@tonic-gate char *a2; 1500Sstevel@tonic-gate char link[PATH_MAX]; 1510Sstevel@tonic-gate char *addr = di_bus_addr(node); 1520Sstevel@tonic-gate char *mn = di_minor_name(minor); 1530Sstevel@tonic-gate 1540Sstevel@tonic-gate if (strcmp(addr, "0,0") == 0) { 1550Sstevel@tonic-gate if (strcmp(mn, "c") == 0) { 1560Sstevel@tonic-gate (void) devfsadm_mklink("diskette", node, minor, 0); 1570Sstevel@tonic-gate } else if (strcmp(mn, "c,raw") == 0) { 1580Sstevel@tonic-gate (void) devfsadm_mklink("rdiskette", node, minor, 0); 1590Sstevel@tonic-gate } 1600Sstevel@tonic-gate 1610Sstevel@tonic-gate } 1620Sstevel@tonic-gate 1630Sstevel@tonic-gate if (addr[0] == '0') { 1640Sstevel@tonic-gate if ((a2 = strchr(addr, ',')) != NULL) { 1650Sstevel@tonic-gate a2++; 1660Sstevel@tonic-gate if (strcmp(mn, "c") == 0) { 1670Sstevel@tonic-gate (void) strcpy(link, "diskette"); 1680Sstevel@tonic-gate (void) strcat(link, a2); 1690Sstevel@tonic-gate (void) devfsadm_mklink(link, node, minor, 0); 1700Sstevel@tonic-gate } else if (strcmp(mn, "c,raw") == 0) { 1710Sstevel@tonic-gate (void) strcpy(link, "rdiskette"); 1720Sstevel@tonic-gate (void) strcat(link, a2); 1730Sstevel@tonic-gate (void) devfsadm_mklink(link, node, minor, 0); 1740Sstevel@tonic-gate } 1750Sstevel@tonic-gate } 1760Sstevel@tonic-gate } 1770Sstevel@tonic-gate 1780Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 1790Sstevel@tonic-gate } 1800Sstevel@tonic-gate 1810Sstevel@tonic-gate /* 1820Sstevel@tonic-gate * type=ddi_printer;name=lp;addr=1,3bc lp0 1830Sstevel@tonic-gate * type=ddi_printer;name=lp;addr=1,378 lp1 1840Sstevel@tonic-gate * type=ddi_printer;name=lp;addr=1,278 lp2 1850Sstevel@tonic-gate */ 1860Sstevel@tonic-gate static int 1870Sstevel@tonic-gate lp(di_minor_t minor, di_node_t node) 1880Sstevel@tonic-gate { 1890Sstevel@tonic-gate char *addr = di_bus_addr(node); 1900Sstevel@tonic-gate char *buf; 1910Sstevel@tonic-gate char path[PATH_MAX + 1]; 1920Sstevel@tonic-gate devfsadm_enumerate_t rules[1] = {"^ecpp([0-9]+)$", 1, MATCH_ALL}; 1930Sstevel@tonic-gate 1940Sstevel@tonic-gate if (strcmp(addr, "1,3bc") == 0) { 1950Sstevel@tonic-gate (void) devfsadm_mklink("lp0", node, minor, 0); 1960Sstevel@tonic-gate 1970Sstevel@tonic-gate } else if (strcmp(addr, "1,378") == 0) { 1980Sstevel@tonic-gate (void) devfsadm_mklink("lp1", node, minor, 0); 1990Sstevel@tonic-gate 2000Sstevel@tonic-gate } else if (strcmp(addr, "1,278") == 0) { 2010Sstevel@tonic-gate (void) devfsadm_mklink("lp2", node, minor, 0); 2020Sstevel@tonic-gate } 2030Sstevel@tonic-gate 2040Sstevel@tonic-gate if (strcmp(di_driver_name(node), "ecpp") != 0) { 2050Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 2060Sstevel@tonic-gate } 2070Sstevel@tonic-gate 2080Sstevel@tonic-gate if ((buf = di_devfs_path(node)) == NULL) { 2090Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 2100Sstevel@tonic-gate } 2110Sstevel@tonic-gate 2120Sstevel@tonic-gate (void) snprintf(path, sizeof (path), "%s:%s", 2130Sstevel@tonic-gate buf, di_minor_name(minor)); 2140Sstevel@tonic-gate 2150Sstevel@tonic-gate di_devfs_path_free(buf); 2160Sstevel@tonic-gate 2170Sstevel@tonic-gate if (devfsadm_enumerate_int(path, 0, &buf, rules, 1)) { 2180Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 2190Sstevel@tonic-gate } 2200Sstevel@tonic-gate 2210Sstevel@tonic-gate (void) snprintf(path, sizeof (path), "ecpp%s", buf); 2220Sstevel@tonic-gate free(buf); 2230Sstevel@tonic-gate (void) devfsadm_mklink(path, node, minor, 0); 2240Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 2250Sstevel@tonic-gate } 2260Sstevel@tonic-gate 2270Sstevel@tonic-gate /* 2280Sstevel@tonic-gate * type=ddi_serial:mb;minor=a tty00 2290Sstevel@tonic-gate * type=ddi_serial:mb;minor=b tty01 2300Sstevel@tonic-gate * type=ddi_serial:mb;minor=c tty02 2310Sstevel@tonic-gate * type=ddi_serial:mb;minor=d tty03 2320Sstevel@tonic-gate */ 2330Sstevel@tonic-gate static int 2340Sstevel@tonic-gate serial(di_minor_t minor, di_node_t node) 2350Sstevel@tonic-gate { 2360Sstevel@tonic-gate 2370Sstevel@tonic-gate char *mn = di_minor_name(minor); 2380Sstevel@tonic-gate char link[PATH_MAX]; 2390Sstevel@tonic-gate 2400Sstevel@tonic-gate (void) strcpy(link, "tty"); 2410Sstevel@tonic-gate (void) strcat(link, mn); 2420Sstevel@tonic-gate (void) devfsadm_mklink(link, node, minor, 0); 2430Sstevel@tonic-gate 2440Sstevel@tonic-gate if (strcmp(mn, "a") == 0) { 2450Sstevel@tonic-gate (void) devfsadm_mklink("tty00", node, minor, 0); 2460Sstevel@tonic-gate 2470Sstevel@tonic-gate } else if (strcmp(mn, "b") == 0) { 2480Sstevel@tonic-gate (void) devfsadm_mklink("tty01", node, minor, 0); 2490Sstevel@tonic-gate 2500Sstevel@tonic-gate } else if (strcmp(mn, "c") == 0) { 2510Sstevel@tonic-gate (void) devfsadm_mklink("tty02", node, minor, 0); 2520Sstevel@tonic-gate 2530Sstevel@tonic-gate } else if (strcmp(mn, "d") == 0) { 2540Sstevel@tonic-gate (void) devfsadm_mklink("tty03", node, minor, 0); 2550Sstevel@tonic-gate } 2560Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 2570Sstevel@tonic-gate } 2580Sstevel@tonic-gate 2590Sstevel@tonic-gate /* 2600Sstevel@tonic-gate * type=ddi_serial:dialout,mb;minor=a,cu ttyd0 2610Sstevel@tonic-gate * type=ddi_serial:dialout,mb;minor=b,cu ttyd1 2620Sstevel@tonic-gate * type=ddi_serial:dialout,mb;minor=c,cu ttyd2 2630Sstevel@tonic-gate * type=ddi_serial:dialout,mb;minor=d,cu ttyd3 2640Sstevel@tonic-gate */ 2650Sstevel@tonic-gate static int 2660Sstevel@tonic-gate serial_dialout(di_minor_t minor, di_node_t node) 2670Sstevel@tonic-gate { 2680Sstevel@tonic-gate char *mn = di_minor_name(minor); 2690Sstevel@tonic-gate 2700Sstevel@tonic-gate if (strcmp(mn, "a,cu") == 0) { 2710Sstevel@tonic-gate (void) devfsadm_mklink("ttyd0", node, minor, 0); 2720Sstevel@tonic-gate (void) devfsadm_mklink("cua0", node, minor, 0); 2730Sstevel@tonic-gate 2740Sstevel@tonic-gate } else if (strcmp(mn, "b,cu") == 0) { 2750Sstevel@tonic-gate (void) devfsadm_mklink("ttyd1", node, minor, 0); 2760Sstevel@tonic-gate (void) devfsadm_mklink("cua1", node, minor, 0); 2770Sstevel@tonic-gate 2780Sstevel@tonic-gate } else if (strcmp(mn, "c,cu") == 0) { 2790Sstevel@tonic-gate (void) devfsadm_mklink("ttyd2", node, minor, 0); 2800Sstevel@tonic-gate (void) devfsadm_mklink("cua2", node, minor, 0); 2810Sstevel@tonic-gate 2820Sstevel@tonic-gate } else if (strcmp(mn, "d,cu") == 0) { 2830Sstevel@tonic-gate (void) devfsadm_mklink("ttyd3", node, minor, 0); 2840Sstevel@tonic-gate (void) devfsadm_mklink("cua3", node, minor, 0); 2850Sstevel@tonic-gate } 2860Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 2870Sstevel@tonic-gate } 2880Sstevel@tonic-gate 2890Sstevel@tonic-gate static int 2900Sstevel@tonic-gate kdmouse(di_minor_t minor, di_node_t node) 2910Sstevel@tonic-gate { 2920Sstevel@tonic-gate (void) devfsadm_mklink("kdmouse", node, minor, 0); 2930Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 2940Sstevel@tonic-gate } 2950Sstevel@tonic-gate 2960Sstevel@tonic-gate static int 2970Sstevel@tonic-gate bmc(di_minor_t minor, di_node_t node) 2980Sstevel@tonic-gate { 2990Sstevel@tonic-gate (void) devfsadm_mklink("bmc", node, minor, 0); 3000Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 3010Sstevel@tonic-gate } 302*437Smws 303*437Smws static int 304*437Smws smbios(di_minor_t minor, di_node_t node) 305*437Smws { 306*437Smws (void) devfsadm_mklink("smbios", node, minor, 0); 307*437Smws return (DEVFSADM_CONTINUE); 308*437Smws } 309*437Smws 3100Sstevel@tonic-gate static int 3110Sstevel@tonic-gate agp_process(di_minor_t minor, di_node_t node) 3120Sstevel@tonic-gate { 3130Sstevel@tonic-gate char *minor_nm, *drv_nm; 3140Sstevel@tonic-gate char *devfspath; 3150Sstevel@tonic-gate char *I_path, *p_path, *buf; 3160Sstevel@tonic-gate char *name = (char *)NULL; 3170Sstevel@tonic-gate int i, index; 3180Sstevel@tonic-gate devfsadm_enumerate_t rules[1]; 3190Sstevel@tonic-gate 3200Sstevel@tonic-gate minor_nm = di_minor_name(minor); 3210Sstevel@tonic-gate drv_nm = di_driver_name(node); 3220Sstevel@tonic-gate 3230Sstevel@tonic-gate if ((minor_nm == NULL) || (drv_nm == NULL)) { 3240Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 3250Sstevel@tonic-gate } 3260Sstevel@tonic-gate 3270Sstevel@tonic-gate devfsadm_print(debug_mid, "agp_process: minor=%s node=%s\n", 3280Sstevel@tonic-gate minor_nm, di_node_name(node)); 3290Sstevel@tonic-gate 3300Sstevel@tonic-gate devfspath = di_devfs_path(node); 3310Sstevel@tonic-gate if (devfspath == NULL) { 3320Sstevel@tonic-gate devfsadm_print(debug_mid, "agp_process: devfspath is NULL\n"); 3330Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 3340Sstevel@tonic-gate } 3350Sstevel@tonic-gate 3360Sstevel@tonic-gate I_path = (char *)malloc(PATH_MAX); 3370Sstevel@tonic-gate 3380Sstevel@tonic-gate if (I_path == NULL) { 3390Sstevel@tonic-gate di_devfs_path_free(devfspath); 3400Sstevel@tonic-gate devfsadm_print(debug_mid, "agp_process: malloc failed\n"); 3410Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 3420Sstevel@tonic-gate } 3430Sstevel@tonic-gate 3440Sstevel@tonic-gate p_path = (char *)malloc(PATH_MAX); 3450Sstevel@tonic-gate 3460Sstevel@tonic-gate if (p_path == NULL) { 3470Sstevel@tonic-gate devfsadm_print(debug_mid, "agp_process: malloc failed\n"); 3480Sstevel@tonic-gate di_devfs_path_free(devfspath); 3490Sstevel@tonic-gate free(I_path); 3500Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 3510Sstevel@tonic-gate } 3520Sstevel@tonic-gate 3530Sstevel@tonic-gate (void) strlcpy(p_path, devfspath, PATH_MAX); 3540Sstevel@tonic-gate (void) strlcat(p_path, ":", PATH_MAX); 3550Sstevel@tonic-gate (void) strlcat(p_path, minor_nm, PATH_MAX); 3560Sstevel@tonic-gate di_devfs_path_free(devfspath); 3570Sstevel@tonic-gate 3580Sstevel@tonic-gate devfsadm_print(debug_mid, "agp_process: path %s\n", p_path); 3590Sstevel@tonic-gate 3600Sstevel@tonic-gate for (i = 0; ; i++) { 3610Sstevel@tonic-gate if ((driver_name_table[i].driver_name == NULL) || 3620Sstevel@tonic-gate (strcmp(drv_nm, driver_name_table[i].driver_name) == 0)) { 3630Sstevel@tonic-gate index = driver_name_table[i].index; 3640Sstevel@tonic-gate break; 3650Sstevel@tonic-gate } 3660Sstevel@tonic-gate } 3670Sstevel@tonic-gate switch (index) { 3680Sstevel@tonic-gate case DRIVER_AGPPSEUDO: 3690Sstevel@tonic-gate devfsadm_print(debug_mid, 3700Sstevel@tonic-gate "agp_process: psdeudo driver name\n"); 3710Sstevel@tonic-gate name = "agpgart"; 3720Sstevel@tonic-gate (void) snprintf(I_path, PATH_MAX, "%s", name); 3730Sstevel@tonic-gate devfsadm_print(debug_mid, 3740Sstevel@tonic-gate "mklink %s -> %s\n", I_path, p_path); 3750Sstevel@tonic-gate 3760Sstevel@tonic-gate (void) devfsadm_mklink(I_path, node, minor, 0); 3770Sstevel@tonic-gate 3780Sstevel@tonic-gate free(I_path); 3790Sstevel@tonic-gate free(p_path); 3800Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 3810Sstevel@tonic-gate case DRIVER_AGPTARGET: 3820Sstevel@tonic-gate devfsadm_print(debug_mid, 3830Sstevel@tonic-gate "agp_process: target driver name\n"); 3840Sstevel@tonic-gate rules[0] = agptarget_rules[0]; 3850Sstevel@tonic-gate name = "agptarget"; 3860Sstevel@tonic-gate break; 3870Sstevel@tonic-gate case DRIVER_CPUGART: 3880Sstevel@tonic-gate devfsadm_print(debug_mid, 3890Sstevel@tonic-gate "agp_process: cpugart driver name\n"); 3900Sstevel@tonic-gate rules[0] = cpugart_rules[0]; 3910Sstevel@tonic-gate name = "cpugart"; 3920Sstevel@tonic-gate break; 3930Sstevel@tonic-gate case DRIVER_AGPMASTER: 3940Sstevel@tonic-gate devfsadm_print(debug_mid, 3950Sstevel@tonic-gate "agp_process: agpmaster driver name\n"); 3960Sstevel@tonic-gate rules[0] = agpmaster_rules[0]; 3970Sstevel@tonic-gate name = "agpmaster"; 3980Sstevel@tonic-gate break; 3990Sstevel@tonic-gate case DRIVER_UNKNOWN: 4000Sstevel@tonic-gate devfsadm_print(debug_mid, 4010Sstevel@tonic-gate "agp_process: unknown driver name=%s\n", drv_nm); 4020Sstevel@tonic-gate free(I_path); 4030Sstevel@tonic-gate free(p_path); 4040Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 4050Sstevel@tonic-gate } 4060Sstevel@tonic-gate 4070Sstevel@tonic-gate if (devfsadm_enumerate_int(p_path, 0, &buf, rules, 1)) { 4080Sstevel@tonic-gate devfsadm_print(debug_mid, "agp_process: exit/coninue\n"); 4090Sstevel@tonic-gate free(I_path); 4100Sstevel@tonic-gate free(p_path); 4110Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 4120Sstevel@tonic-gate } 4130Sstevel@tonic-gate 4140Sstevel@tonic-gate 4150Sstevel@tonic-gate (void) snprintf(I_path, PATH_MAX, "agp/%s%s", name, buf); 4160Sstevel@tonic-gate 4170Sstevel@tonic-gate devfsadm_print(debug_mid, "agp_process: p_path=%s buf=%s\n", 4180Sstevel@tonic-gate p_path, buf); 4190Sstevel@tonic-gate 4200Sstevel@tonic-gate free(buf); 4210Sstevel@tonic-gate 4220Sstevel@tonic-gate devfsadm_print(debug_mid, "mklink %s -> %s\n", I_path, p_path); 4230Sstevel@tonic-gate 4240Sstevel@tonic-gate (void) devfsadm_mklink(I_path, node, minor, 0); 4250Sstevel@tonic-gate 4260Sstevel@tonic-gate free(p_path); 4270Sstevel@tonic-gate free(I_path); 4280Sstevel@tonic-gate 4290Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 4300Sstevel@tonic-gate } 431