diff options
author | Hans Rosenfeld <hans.rosenfeld@joyent.com> | 2020-01-12 01:01:41 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-12 01:01:41 +0100 |
commit | b44b91e41531b86f9807aecf62d96cad6f2f06cd (patch) | |
tree | 1fe4c2409126f74cddb013d220c824367d9dc788 /usr/src/cmd/devfsadm | |
parent | 8b175886ef45935e972cf1df20218f2de66d49b1 (diff) | |
download | illumos-joyent-b44b91e41531b86f9807aecf62d96cad6f2f06cd.tar.gz |
OS-7196 Need native CCID driver
Contributed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: John Levon <john.levon@joyent.com>
Approved by: Jason King <jbk@joyent.com>
Diffstat (limited to 'usr/src/cmd/devfsadm')
-rw-r--r-- | usr/src/cmd/devfsadm/cfg_link.c | 29 | ||||
-rw-r--r-- | usr/src/cmd/devfsadm/cfg_link.h | 4 | ||||
-rw-r--r-- | usr/src/cmd/devfsadm/usb_link.c | 36 |
3 files changed, 68 insertions, 1 deletions
diff --git a/usr/src/cmd/devfsadm/cfg_link.c b/usr/src/cmd/devfsadm/cfg_link.c index e7229325ac..4415ad55ce 100644 --- a/usr/src/cmd/devfsadm/cfg_link.c +++ b/usr/src/cmd/devfsadm/cfg_link.c @@ -20,6 +20,7 @@ */ /* + * Copyright 2019, Joyent, Inc. * Copyright 2016 Nexenta Systems, Inc. All rights reserved. * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. @@ -59,6 +60,7 @@ static int pci_cfg_creat_cb(di_minor_t minor, di_node_t node); static int ib_cfg_creat_cb(di_minor_t minor, di_node_t node); static int sata_cfg_creat_cb(di_minor_t minor, di_node_t node); static int sdcard_cfg_creat_cb(di_minor_t minor, di_node_t node); +static int ccid_cfg_creat_cb(di_minor_t minor, di_node_t node); static di_node_t pci_cfg_chassis_node(di_node_t, di_prom_handle_t); static char *pci_cfg_slotname(di_node_t, di_prom_handle_t, minor_t); @@ -120,6 +122,9 @@ static devfsadm_create_t cfg_create_cbt[] = { }, { "attachment-point", DDI_NT_SDCARD_ATTACHMENT_POINT, NULL, TYPE_EXACT, ILEVEL_0, sdcard_cfg_creat_cb + }, + { "attachment-point", DDI_NT_CCID_ATTACHMENT_POINT, NULL, + TYPE_EXACT, ILEVEL_0, ccid_cfg_creat_cb } }; @@ -153,6 +158,9 @@ static devfsadm_remove_t cfg_remove_cbt[] = { { "attachment-point", SDCARD_CFG_LINK_RE, RM_POST|RM_HOT|RM_ALWAYS, ILEVEL_0, devfsadm_rm_all }, + { "attachment-point", CCID_CFG_LINK_RE, RM_POST|RM_HOT|RM_ALWAYS, + ILEVEL_0, devfsadm_rm_all + } }; DEVFSADM_REMOVE_INIT_V0(cfg_remove_cbt); @@ -1246,3 +1254,24 @@ serid_printable(uint64_t *seridp) return (1); } + +/* + * Create a link for cfgadm that points back to the normal ccid links in + * /dev/ccid. + */ +static int +ccid_cfg_creat_cb(di_minor_t minor, di_node_t node) +{ + const char *minor_nm; + char cfg_path[MAXPATHLEN]; + + if ((minor_nm = di_minor_name(minor)) == NULL) { + return (DEVFSADM_CONTINUE); + } + + (void) snprintf(cfg_path, sizeof (cfg_path), "%s/ccid%d/%s", + CFG_DIRNAME, di_instance(node), minor_nm); + + (void) devfsadm_mklink(cfg_path, node, minor, 0); + return (DEVFSADM_CONTINUE); +} diff --git a/usr/src/cmd/devfsadm/cfg_link.h b/usr/src/cmd/devfsadm/cfg_link.h index e2bb24864d..7c3cf13eb8 100644 --- a/usr/src/cmd/devfsadm/cfg_link.h +++ b/usr/src/cmd/devfsadm/cfg_link.h @@ -22,6 +22,9 @@ * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ +/* + * Copyright 2019, Joyent, Inc. + */ /* private devlink info interfaces */ @@ -43,6 +46,7 @@ extern "C" { #define SDCARD_CFG_LINK_RE "^cfg/sdcard[0-9]+/[0-9]+$" #define PCI_CFG_PATH_LINK_RE \ "^cfg/(.*(pci[0-9]|pcie[0-9]|Slot[0-9]|\\<pci\\>|\\<pcie\\>).*)$" +#define CCID_CFG_LINK_RE "^cfg/ccid[0-9]+/slot[0-9]+$" #define CFG_DIRNAME "cfg" diff --git a/usr/src/cmd/devfsadm/usb_link.c b/usr/src/cmd/devfsadm/usb_link.c index ac6a8447fb..80996a1773 100644 --- a/usr/src/cmd/devfsadm/usb_link.c +++ b/usr/src/cmd/devfsadm/usb_link.c @@ -21,6 +21,9 @@ * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ +/* + * Copyright 2019, Joyent, Inc. + */ #include <devfsadm.h> #include <stdio.h> @@ -37,6 +40,8 @@ static int usb_process(di_minor_t minor, di_node_t node); static void ugen_create_link(char *p_path, char *node_name, di_node_t node, di_minor_t minor); +static void ccid_create_link(char *p_path, char *node_name, + di_node_t node, di_minor_t minor); /* Rules for creating links */ @@ -81,6 +86,8 @@ static devfsadm_create_t usb_cbt[] = { ILEVEL_0, usb_process }, { "usb", DDI_NT_NEXUS, "hwahc", DRV_EXACT|TYPE_EXACT, ILEVEL_0, usb_process }, + { "usb", DDI_NT_CCID_ATTACHMENT_POINT, "ccid", DRV_EXACT|TYPE_EXACT, + ILEVEL_0, usb_process }, }; /* For debug printing (-V filter) */ @@ -105,6 +112,7 @@ DEVFSADM_CREATE_INIT_V0(usb_cbt); #define USB_LINK_RE_WHOST "^usb/whost[0-9]+$" #define USB_LINK_RE_HWARC "^usb/hwarc[0-9]+$" #define USB_LINK_RE_WUSB_CA "^usb/wusb_ca[0-9]+$" +#define USB_LINK_RE_CCID "^ccid/ccid[0-9]+/slot[0-9]+$" /* Rules for removing links */ static devfsadm_remove_t usb_remove_cbt[] = { @@ -138,7 +146,9 @@ static devfsadm_remove_t usb_remove_cbt[] = { { "usb", USB_LINK_RE_HWARC, RM_POST | RM_HOT | RM_ALWAYS, ILEVEL_0, devfsadm_rm_all }, { "usb", USB_LINK_RE_WUSB_CA, RM_POST | RM_HOT | RM_ALWAYS, ILEVEL_0, - devfsadm_rm_all } + devfsadm_rm_all }, + { "usb", USB_LINK_RE_CCID, RM_POST | RM_HOT | RM_ALWAYS, ILEVEL_0, + devfsadm_rm_all } }; /* @@ -306,6 +316,14 @@ usb_process(di_minor_t minor, di_node_t node) return (DEVFSADM_CONTINUE); } + if (strcmp(di_minor_nodetype(minor), DDI_NT_CCID_ATTACHMENT_POINT) + == 0) { + ccid_create_link(p_path, minor_nm, node, minor); + free(l_path); + free(p_path); + return (DEVFSADM_CONTINUE); + } + /* Figure out which rules to apply */ switch (index) { case DRIVER_HUBD: @@ -493,3 +511,19 @@ ugen_create_link(char *p_path, char *node_name, free(buf); } + +/* + * Create a CCID related link. + */ +static void +ccid_create_link(char *p_path, char *minor_nm, di_node_t node, di_minor_t minor) +{ + char l_path[MAXPATHLEN]; + + (void) snprintf(l_path, sizeof (l_path), "ccid/ccid%d/%s", + di_instance(node), minor_nm); + + devfsadm_print(debug_mid, "mklink %s -> %s\n", l_path, p_path); + + (void) devfsadm_mklink(l_path, node, minor, 0); +} |