1ae115bc7Smrj /* 2ae115bc7Smrj * CDDL HEADER START 3ae115bc7Smrj * 4ae115bc7Smrj * The contents of this file are subject to the terms of the 5ae115bc7Smrj * Common Development and Distribution License (the "License"). 6ae115bc7Smrj * You may not use this file except in compliance with the License. 7ae115bc7Smrj * 8ae115bc7Smrj * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9ae115bc7Smrj * or http://www.opensolaris.org/os/licensing. 10ae115bc7Smrj * See the License for the specific language governing permissions 11ae115bc7Smrj * and limitations under the License. 12ae115bc7Smrj * 13ae115bc7Smrj * When distributing Covered Code, include this CDDL HEADER in each 14ae115bc7Smrj * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15ae115bc7Smrj * If applicable, add the following below this CDDL HEADER, with the 16ae115bc7Smrj * fields enclosed by brackets "[]" replaced with your own identifying 17ae115bc7Smrj * information: Portions Copyright [yyyy] [name of copyright owner] 18ae115bc7Smrj * 19ae115bc7Smrj * CDDL HEADER END 20ae115bc7Smrj */ 21ae115bc7Smrj 22ae115bc7Smrj /* 2378323854SJudy Chen * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 24ae115bc7Smrj * Use is subject to license terms. 25ae115bc7Smrj */ 26ae115bc7Smrj 27ae115bc7Smrj /* 28ae115bc7Smrj * isa-specific console configuration routines 29ae115bc7Smrj */ 30ae115bc7Smrj 31ae115bc7Smrj #include <sys/types.h> 32ae115bc7Smrj #include <sys/param.h> 33ae115bc7Smrj #include <sys/cmn_err.h> 34ae115bc7Smrj #include <sys/systm.h> 35ae115bc7Smrj #include <sys/conf.h> 36ae115bc7Smrj #include <sys/debug.h> 37ae115bc7Smrj #include <sys/ddi.h> 38ae115bc7Smrj #include <sys/sunddi.h> 39ae115bc7Smrj #include <sys/sunndi.h> 40ae115bc7Smrj #include <sys/esunddi.h> 41ae115bc7Smrj #include <sys/ddi_impldefs.h> 42ae115bc7Smrj #include <sys/promif.h> 43ae115bc7Smrj #include <sys/modctl.h> 44ae115bc7Smrj #include <sys/termios.h> 45*45e46d06Srui zang - Sun Microsystems - Beijing China #include <sys/pci.h> 46843e1988Sjohnlev #if defined(__xpv) 47843e1988Sjohnlev #include <sys/hypervisor.h> 48843e1988Sjohnlev #include <sys/boot_console.h> 49843e1988Sjohnlev #endif 50ae115bc7Smrj 5178323854SJudy Chen extern int pseudo_isa; 5278323854SJudy Chen 53ae115bc7Smrj int 54ae115bc7Smrj plat_use_polled_debug() { 55ae115bc7Smrj return (0); 56ae115bc7Smrj } 57ae115bc7Smrj 58ae115bc7Smrj int 59ae115bc7Smrj plat_support_serial_kbd_and_ms() { 60ae115bc7Smrj return (0); 61ae115bc7Smrj } 62ae115bc7Smrj 63843e1988Sjohnlev #define A_CNT(arr) (sizeof (arr) / sizeof (arr[0])) 64843e1988Sjohnlev 65ae115bc7Smrj #define CONS_INVALID -1 66ae115bc7Smrj #define CONS_SCREEN 0 67ae115bc7Smrj #define CONS_TTYA 1 68ae115bc7Smrj #define CONS_TTYB 2 69ae115bc7Smrj #define CONS_USBSER 3 70843e1988Sjohnlev #define CONS_HYPERVISOR 4 71ae115bc7Smrj 72583da248Srz201010 char *plat_fbpath(void); 73583da248Srz201010 74ae115bc7Smrj static int 75ae115bc7Smrj console_type() 76ae115bc7Smrj { 77ae115bc7Smrj static int boot_console = CONS_INVALID; 78ae115bc7Smrj 79ae115bc7Smrj char *cons; 80ae115bc7Smrj dev_info_t *root; 81ae115bc7Smrj 82ae115bc7Smrj if (boot_console != CONS_INVALID) 83ae115bc7Smrj return (boot_console); 84ae115bc7Smrj 85843e1988Sjohnlev #if defined(__xpv) 86843e1988Sjohnlev if (!DOMAIN_IS_INITDOMAIN(xen_info) || bcons_hypervisor_redirect()) { 87843e1988Sjohnlev boot_console = CONS_HYPERVISOR; 88843e1988Sjohnlev return (boot_console); 89843e1988Sjohnlev } 90843e1988Sjohnlev #endif /* __xpv */ 91843e1988Sjohnlev 92ae115bc7Smrj /* 93ae115bc7Smrj * console is defined by "console" property, with 94ae115bc7Smrj * fallback on the old "input-device" property. 95583da248Srz201010 * If "input-device" is not defined either, also check "output-device". 96ae115bc7Smrj */ 97ae115bc7Smrj boot_console = CONS_SCREEN; /* default is screen/kb */ 98ae115bc7Smrj root = ddi_root_node(); 99ae115bc7Smrj if ((ddi_prop_lookup_string(DDI_DEV_T_ANY, root, 100ae115bc7Smrj DDI_PROP_DONTPASS, "console", &cons) == DDI_SUCCESS) || 101ae115bc7Smrj (ddi_prop_lookup_string(DDI_DEV_T_ANY, root, 102583da248Srz201010 DDI_PROP_DONTPASS, "input-device", &cons) == DDI_SUCCESS) || 103583da248Srz201010 (ddi_prop_lookup_string(DDI_DEV_T_ANY, root, 104583da248Srz201010 DDI_PROP_DONTPASS, "output-device", &cons) == DDI_SUCCESS)) { 105843e1988Sjohnlev if (strcmp(cons, "ttya") == 0) { 106ae115bc7Smrj boot_console = CONS_TTYA; 107843e1988Sjohnlev } else if (strcmp(cons, "ttyb") == 0) { 108ae115bc7Smrj boot_console = CONS_TTYB; 109843e1988Sjohnlev } else if (strcmp(cons, "usb-serial") == 0) { 110ae115bc7Smrj (void) i_ddi_attach_hw_nodes("ehci"); 111ae115bc7Smrj (void) i_ddi_attach_hw_nodes("uhci"); 112ae115bc7Smrj (void) i_ddi_attach_hw_nodes("ohci"); 113ae115bc7Smrj /* 114ae115bc7Smrj * USB device enumerate asynchronously. 115ae115bc7Smrj * Wait 2 seconds for USB serial devices to attach. 116ae115bc7Smrj */ 117ae115bc7Smrj delay(drv_usectohz(2000000)); 118ae115bc7Smrj boot_console = CONS_USBSER; 119843e1988Sjohnlev #if defined(__xpv) 120843e1988Sjohnlev } else if (strcmp(cons, "hypervisor") == 0) { 121843e1988Sjohnlev boot_console = CONS_HYPERVISOR; 122843e1988Sjohnlev #endif /* __xpv */ 123ae115bc7Smrj } 124ae115bc7Smrj ddi_prop_free(cons); 125ae115bc7Smrj } 126583da248Srz201010 127583da248Srz201010 /* 128583da248Srz201010 * If the console is configured to use a framebuffer but none 129583da248Srz201010 * could be found, fallback to "ttya" since it's likely to exist 130583da248Srz201010 * and it matches longstanding behavior on SPARC. 131583da248Srz201010 */ 132583da248Srz201010 if (boot_console == CONS_SCREEN && plat_fbpath() == NULL) 133583da248Srz201010 boot_console = CONS_TTYA; 134583da248Srz201010 135ae115bc7Smrj return (boot_console); 136ae115bc7Smrj } 137ae115bc7Smrj 138ae115bc7Smrj int 139ae115bc7Smrj plat_stdin_is_keyboard(void) 140ae115bc7Smrj { 141ae115bc7Smrj return (console_type() == CONS_SCREEN); 142ae115bc7Smrj } 143ae115bc7Smrj 144ae115bc7Smrj int 145ae115bc7Smrj plat_stdout_is_framebuffer(void) 146ae115bc7Smrj { 147ae115bc7Smrj return (console_type() == CONS_SCREEN); 148ae115bc7Smrj } 149ae115bc7Smrj 15078323854SJudy Chen static char * 15178323854SJudy Chen plat_devpath(char *name, char *path) 15278323854SJudy Chen { 15378323854SJudy Chen major_t major; 15478323854SJudy Chen dev_info_t *dip, *pdip; 15578323854SJudy Chen 15678323854SJudy Chen if ((major = ddi_name_to_major(name)) == (major_t)-1) 15778323854SJudy Chen return (NULL); 15878323854SJudy Chen 15978323854SJudy Chen if ((dip = devnamesp[major].dn_head) == NULL) 16078323854SJudy Chen return (NULL); 16178323854SJudy Chen 16278323854SJudy Chen pdip = ddi_get_parent(dip); 16378323854SJudy Chen if (i_ddi_attach_node_hierarchy(pdip) != DDI_SUCCESS) 16478323854SJudy Chen return (NULL); 16578323854SJudy Chen if (ddi_initchild(pdip, dip) != DDI_SUCCESS) 16678323854SJudy Chen return (NULL); 16778323854SJudy Chen 16878323854SJudy Chen (void) ddi_pathname(dip, path); 16978323854SJudy Chen 17078323854SJudy Chen return (path); 17178323854SJudy Chen } 17278323854SJudy Chen 173ae115bc7Smrj /* 174ae115bc7Smrj * Return generic path to keyboard device from the alias. 175ae115bc7Smrj */ 176ae115bc7Smrj char * 177ae115bc7Smrj plat_kbdpath(void) 178ae115bc7Smrj { 17978323854SJudy Chen static char kbpath[MAXPATHLEN]; 18078323854SJudy Chen 181ae115bc7Smrj /* 182ae115bc7Smrj * Hardcode to isa keyboard path 183ae115bc7Smrj * XXX make it settable via bootprop? 184ae115bc7Smrj */ 18578323854SJudy Chen if (pseudo_isa) 186ae115bc7Smrj return ("/isa/i8042@1,60/keyboard@0"); 18778323854SJudy Chen 18878323854SJudy Chen if (plat_devpath("kb8042", kbpath) == NULL) 18978323854SJudy Chen return (NULL); 19078323854SJudy Chen 19178323854SJudy Chen return (kbpath); 192ae115bc7Smrj } 193ae115bc7Smrj 194*45e46d06Srui zang - Sun Microsystems - Beijing China static int 195*45e46d06Srui zang - Sun Microsystems - Beijing China find_fb_dev(dev_info_t *dip, void *found_dip) 196*45e46d06Srui zang - Sun Microsystems - Beijing China { 197*45e46d06Srui zang - Sun Microsystems - Beijing China char *dev_type; 198*45e46d06Srui zang - Sun Microsystems - Beijing China dev_info_t *pdip; 199*45e46d06Srui zang - Sun Microsystems - Beijing China char *parent_type; 200*45e46d06Srui zang - Sun Microsystems - Beijing China 201*45e46d06Srui zang - Sun Microsystems - Beijing China if (dip == ddi_root_node()) 202*45e46d06Srui zang - Sun Microsystems - Beijing China return (DDI_WALK_CONTINUE); 203*45e46d06Srui zang - Sun Microsystems - Beijing China 204*45e46d06Srui zang - Sun Microsystems - Beijing China if (ddi_prop_lookup_string(DDI_DEV_T_ANY, dip, DDI_PROP_DONTPASS, 205*45e46d06Srui zang - Sun Microsystems - Beijing China "device_type", &dev_type) != DDI_SUCCESS) 206*45e46d06Srui zang - Sun Microsystems - Beijing China return (DDI_WALK_PRUNECHILD); 207*45e46d06Srui zang - Sun Microsystems - Beijing China 208*45e46d06Srui zang - Sun Microsystems - Beijing China if ((strcmp(dev_type, "isa") == 0) || (strcmp(dev_type, "eisa") == 0)) { 209*45e46d06Srui zang - Sun Microsystems - Beijing China ddi_prop_free(dev_type); 210*45e46d06Srui zang - Sun Microsystems - Beijing China return (DDI_WALK_CONTINUE); 211*45e46d06Srui zang - Sun Microsystems - Beijing China } 212*45e46d06Srui zang - Sun Microsystems - Beijing China 213*45e46d06Srui zang - Sun Microsystems - Beijing China if ((strcmp(dev_type, "pci") == 0) || 214*45e46d06Srui zang - Sun Microsystems - Beijing China (strcmp(dev_type, "pciex") == 0)) { 215*45e46d06Srui zang - Sun Microsystems - Beijing China ddi_acc_handle_t pci_conf; 216*45e46d06Srui zang - Sun Microsystems - Beijing China uint16_t data16; 217*45e46d06Srui zang - Sun Microsystems - Beijing China 218*45e46d06Srui zang - Sun Microsystems - Beijing China ddi_prop_free(dev_type); 219*45e46d06Srui zang - Sun Microsystems - Beijing China 220*45e46d06Srui zang - Sun Microsystems - Beijing China if (i_ddi_attach_node_hierarchy(dip) != DDI_SUCCESS) 221*45e46d06Srui zang - Sun Microsystems - Beijing China return (DDI_WALK_CONTINUE); 222*45e46d06Srui zang - Sun Microsystems - Beijing China 223*45e46d06Srui zang - Sun Microsystems - Beijing China if (pci_config_setup(dip, &pci_conf) != DDI_SUCCESS) { 224*45e46d06Srui zang - Sun Microsystems - Beijing China /* This happends when it's the host bridge */ 225*45e46d06Srui zang - Sun Microsystems - Beijing China return (DDI_WALK_CONTINUE); 226*45e46d06Srui zang - Sun Microsystems - Beijing China } 227*45e46d06Srui zang - Sun Microsystems - Beijing China 228*45e46d06Srui zang - Sun Microsystems - Beijing China data16 = pci_config_get16(pci_conf, PCI_BCNF_BCNTRL); 229*45e46d06Srui zang - Sun Microsystems - Beijing China pci_config_teardown(&pci_conf); 230*45e46d06Srui zang - Sun Microsystems - Beijing China 231*45e46d06Srui zang - Sun Microsystems - Beijing China if (data16 & PCI_BCNF_BCNTRL_VGA_ENABLE) 232*45e46d06Srui zang - Sun Microsystems - Beijing China return (DDI_WALK_CONTINUE); 233*45e46d06Srui zang - Sun Microsystems - Beijing China 234*45e46d06Srui zang - Sun Microsystems - Beijing China return (DDI_WALK_PRUNECHILD); 235*45e46d06Srui zang - Sun Microsystems - Beijing China } 236*45e46d06Srui zang - Sun Microsystems - Beijing China 237*45e46d06Srui zang - Sun Microsystems - Beijing China if (strcmp(dev_type, "display") != 0) { 238*45e46d06Srui zang - Sun Microsystems - Beijing China ddi_prop_free(dev_type); 239*45e46d06Srui zang - Sun Microsystems - Beijing China return (DDI_WALK_CONTINUE); 240*45e46d06Srui zang - Sun Microsystems - Beijing China } 241*45e46d06Srui zang - Sun Microsystems - Beijing China 242*45e46d06Srui zang - Sun Microsystems - Beijing China ddi_prop_free(dev_type); 243*45e46d06Srui zang - Sun Microsystems - Beijing China 244*45e46d06Srui zang - Sun Microsystems - Beijing China if ((pdip = ddi_get_parent(dip)) == NULL) 245*45e46d06Srui zang - Sun Microsystems - Beijing China return (DDI_WALK_CONTINUE); 246*45e46d06Srui zang - Sun Microsystems - Beijing China 247*45e46d06Srui zang - Sun Microsystems - Beijing China if (ddi_prop_lookup_string(DDI_DEV_T_ANY, pdip, DDI_PROP_DONTPASS, 248*45e46d06Srui zang - Sun Microsystems - Beijing China "device_type", &parent_type) != DDI_SUCCESS) 249*45e46d06Srui zang - Sun Microsystems - Beijing China return (DDI_WALK_CONTINUE); 250*45e46d06Srui zang - Sun Microsystems - Beijing China 251*45e46d06Srui zang - Sun Microsystems - Beijing China if ((strcmp(parent_type, "isa") == 0) || 252*45e46d06Srui zang - Sun Microsystems - Beijing China (strcmp(parent_type, "eisa") == 0)) { 253*45e46d06Srui zang - Sun Microsystems - Beijing China *(dev_info_t **)found_dip = dip; 254*45e46d06Srui zang - Sun Microsystems - Beijing China ddi_prop_free(parent_type); 255*45e46d06Srui zang - Sun Microsystems - Beijing China return (DDI_WALK_TERMINATE); 256*45e46d06Srui zang - Sun Microsystems - Beijing China } 257*45e46d06Srui zang - Sun Microsystems - Beijing China 258*45e46d06Srui zang - Sun Microsystems - Beijing China if ((strcmp(parent_type, "pci") == 0) || 259*45e46d06Srui zang - Sun Microsystems - Beijing China (strcmp(parent_type, "pciex") == 0)) { 260*45e46d06Srui zang - Sun Microsystems - Beijing China ddi_acc_handle_t pci_conf; 261*45e46d06Srui zang - Sun Microsystems - Beijing China uint16_t data16; 262*45e46d06Srui zang - Sun Microsystems - Beijing China 263*45e46d06Srui zang - Sun Microsystems - Beijing China ddi_prop_free(parent_type); 264*45e46d06Srui zang - Sun Microsystems - Beijing China 265*45e46d06Srui zang - Sun Microsystems - Beijing China if (i_ddi_attach_node_hierarchy(dip) != DDI_SUCCESS) 266*45e46d06Srui zang - Sun Microsystems - Beijing China return (DDI_WALK_CONTINUE); 267*45e46d06Srui zang - Sun Microsystems - Beijing China 268*45e46d06Srui zang - Sun Microsystems - Beijing China if (pci_config_setup(dip, &pci_conf) != DDI_SUCCESS) 269*45e46d06Srui zang - Sun Microsystems - Beijing China return (DDI_WALK_CONTINUE); 270*45e46d06Srui zang - Sun Microsystems - Beijing China 271*45e46d06Srui zang - Sun Microsystems - Beijing China data16 = pci_config_get16(pci_conf, PCI_CONF_COMM); 272*45e46d06Srui zang - Sun Microsystems - Beijing China pci_config_teardown(&pci_conf); 273*45e46d06Srui zang - Sun Microsystems - Beijing China 274*45e46d06Srui zang - Sun Microsystems - Beijing China if (!(data16 & PCI_COMM_IO)) 275*45e46d06Srui zang - Sun Microsystems - Beijing China return (DDI_WALK_CONTINUE); 276*45e46d06Srui zang - Sun Microsystems - Beijing China 277*45e46d06Srui zang - Sun Microsystems - Beijing China *(dev_info_t **)found_dip = dip; 278*45e46d06Srui zang - Sun Microsystems - Beijing China return (DDI_WALK_TERMINATE); 279*45e46d06Srui zang - Sun Microsystems - Beijing China } 280*45e46d06Srui zang - Sun Microsystems - Beijing China 281*45e46d06Srui zang - Sun Microsystems - Beijing China ddi_prop_free(parent_type); 282*45e46d06Srui zang - Sun Microsystems - Beijing China return (DDI_WALK_CONTINUE); 283*45e46d06Srui zang - Sun Microsystems - Beijing China } 284*45e46d06Srui zang - Sun Microsystems - Beijing China 285ae115bc7Smrj /* 286*45e46d06Srui zang - Sun Microsystems - Beijing China * Conduct a width-first traverse searching for a display device which 287*45e46d06Srui zang - Sun Microsystems - Beijing China * has either: 288*45e46d06Srui zang - Sun Microsystems - Beijing China * 1) a VGA device. 289*45e46d06Srui zang - Sun Microsystems - Beijing China * 2) a PCI VGA compatible device whose IO space is enabled 290*45e46d06Srui zang - Sun Microsystems - Beijing China * and the VGA Enable bit of any PCI-PCI bridge above it is set. 291*45e46d06Srui zang - Sun Microsystems - Beijing China * 292*45e46d06Srui zang - Sun Microsystems - Beijing China * Return the device path as the console fb path. 293ae115bc7Smrj */ 294ae115bc7Smrj char * 295ae115bc7Smrj plat_fbpath(void) 296ae115bc7Smrj { 297*45e46d06Srui zang - Sun Microsystems - Beijing China dev_info_t *fb_dip = NULL; 298ae115bc7Smrj static char *fbpath = NULL; 299ae115bc7Smrj static char fbpath_buf[MAXPATHLEN]; 300ae115bc7Smrj 301*45e46d06Srui zang - Sun Microsystems - Beijing China ddi_walk_devs(ddi_root_node(), find_fb_dev, &fb_dip); 302843e1988Sjohnlev 303*45e46d06Srui zang - Sun Microsystems - Beijing China if (fb_dip == NULL) 304*45e46d06Srui zang - Sun Microsystems - Beijing China return (NULL); 305843e1988Sjohnlev 306*45e46d06Srui zang - Sun Microsystems - Beijing China (void) ddi_pathname(fb_dip, fbpath_buf); 307ae115bc7Smrj fbpath = fbpath_buf; 308ae115bc7Smrj 309843e1988Sjohnlev return (fbpath); 310ae115bc7Smrj } 311ae115bc7Smrj 312ae115bc7Smrj char * 313ae115bc7Smrj plat_mousepath(void) 314ae115bc7Smrj { 31578323854SJudy Chen static char mpath[MAXPATHLEN]; 31678323854SJudy Chen 317ae115bc7Smrj /* 318ae115bc7Smrj * Hardcode to isa mouse path 319ae115bc7Smrj * XXX make it settable via bootprop? 320ae115bc7Smrj */ 32178323854SJudy Chen if (pseudo_isa) 322ae115bc7Smrj return ("/isa/i8042@1,60/mouse@1"); 32378323854SJudy Chen 32478323854SJudy Chen if (plat_devpath("mouse8042", mpath) == NULL) 32578323854SJudy Chen return (NULL); 32678323854SJudy Chen 32778323854SJudy Chen return (mpath); 328ae115bc7Smrj } 329ae115bc7Smrj 330ae115bc7Smrj /* return path of first usb serial device */ 331ae115bc7Smrj static char * 332ae115bc7Smrj plat_usbser_path(void) 333ae115bc7Smrj { 334ae115bc7Smrj extern dev_info_t *usbser_first_device(void); 335ae115bc7Smrj 336ae115bc7Smrj dev_info_t *us_dip; 337ae115bc7Smrj static char *us_path = NULL; 338ae115bc7Smrj 339ae115bc7Smrj if (us_path) 340ae115bc7Smrj return (us_path); 341ae115bc7Smrj 342ae115bc7Smrj us_dip = usbser_first_device(); 343ae115bc7Smrj if (us_dip == NULL) 344ae115bc7Smrj return (NULL); 345ae115bc7Smrj 346ae115bc7Smrj us_path = kmem_alloc(MAXPATHLEN, KM_SLEEP); 347ae115bc7Smrj (void) ddi_pathname(us_dip, us_path); 348ae115bc7Smrj ndi_rele_devi(us_dip); /* held from usbser_first_device */ 349ae115bc7Smrj return (us_path); 350ae115bc7Smrj } 351ae115bc7Smrj 35278323854SJudy Chen static char * 35378323854SJudy Chen plat_ttypath(int inum) 35478323854SJudy Chen { 35578323854SJudy Chen static char *defaultpath[] = { 35678323854SJudy Chen "/isa/asy@1,3f8:a", 35778323854SJudy Chen "/isa/asy@1,2f8:b" 35878323854SJudy Chen }; 35978323854SJudy Chen static char path[MAXPATHLEN]; 36078323854SJudy Chen char *bp; 36178323854SJudy Chen major_t major; 36278323854SJudy Chen dev_info_t *dip; 36378323854SJudy Chen 36478323854SJudy Chen if (pseudo_isa) 36578323854SJudy Chen return (defaultpath[inum]); 36678323854SJudy Chen 36778323854SJudy Chen if ((major = ddi_name_to_major("asy")) == (major_t)-1) 36878323854SJudy Chen return (NULL); 36978323854SJudy Chen 37078323854SJudy Chen if ((dip = devnamesp[major].dn_head) == NULL) 37178323854SJudy Chen return (NULL); 37278323854SJudy Chen 37301457ffdSJudy Chen for (; dip != NULL; dip = ddi_get_next(dip)) { 37478323854SJudy Chen if (i_ddi_attach_node_hierarchy(dip) != DDI_SUCCESS) 37578323854SJudy Chen return (NULL); 37678323854SJudy Chen 37701457ffdSJudy Chen if (DEVI(dip)->devi_minor->ddm_name[0] == ('a' + (char)inum)) 37801457ffdSJudy Chen break; 37901457ffdSJudy Chen } 38001457ffdSJudy Chen if (dip == NULL) 38101457ffdSJudy Chen return (NULL); 38201457ffdSJudy Chen 38378323854SJudy Chen (void) ddi_pathname(dip, path); 38478323854SJudy Chen bp = path + strlen(path); 38578323854SJudy Chen (void) snprintf(bp, 3, ":%s", DEVI(dip)->devi_minor->ddm_name); 38678323854SJudy Chen 38778323854SJudy Chen return (path); 38878323854SJudy Chen } 38978323854SJudy Chen 390ae115bc7Smrj /* 391ae115bc7Smrj * Lacking support for com2 and com3, if that matters. 392ae115bc7Smrj * Another possible enhancement could be to use properties 393ae115bc7Smrj * for the port mapping rather than simply hard-code them. 394ae115bc7Smrj */ 395ae115bc7Smrj char * 396ae115bc7Smrj plat_stdinpath(void) 397ae115bc7Smrj { 398ae115bc7Smrj switch (console_type()) { 399843e1988Sjohnlev #if defined(__xpv) 400843e1988Sjohnlev case CONS_HYPERVISOR: 401843e1988Sjohnlev return ("/xpvd/xencons@0"); 402843e1988Sjohnlev #endif /* __xpv */ 403ae115bc7Smrj case CONS_TTYA: 40478323854SJudy Chen return (plat_ttypath(0)); 405ae115bc7Smrj case CONS_TTYB: 40678323854SJudy Chen return (plat_ttypath(1)); 407ae115bc7Smrj case CONS_USBSER: 408ae115bc7Smrj return (plat_usbser_path()); 409ae115bc7Smrj case CONS_SCREEN: 410ae115bc7Smrj default: 411ae115bc7Smrj break; 412ae115bc7Smrj }; 413ae115bc7Smrj return (plat_kbdpath()); 414ae115bc7Smrj } 415ae115bc7Smrj 416ae115bc7Smrj char * 417ae115bc7Smrj plat_stdoutpath(void) 418ae115bc7Smrj { 419ae115bc7Smrj switch (console_type()) { 420843e1988Sjohnlev #if defined(__xpv) 421843e1988Sjohnlev case CONS_HYPERVISOR: 422843e1988Sjohnlev return ("/xpvd/xencons@0"); 423843e1988Sjohnlev #endif /* __xpv */ 424ae115bc7Smrj case CONS_TTYA: 42578323854SJudy Chen return (plat_ttypath(0)); 426ae115bc7Smrj case CONS_TTYB: 42778323854SJudy Chen return (plat_ttypath(1)); 428ae115bc7Smrj case CONS_USBSER: 429ae115bc7Smrj return (plat_usbser_path()); 430ae115bc7Smrj case CONS_SCREEN: 431ae115bc7Smrj default: 432ae115bc7Smrj break; 433ae115bc7Smrj }; 434ae115bc7Smrj return (plat_fbpath()); 435ae115bc7Smrj } 436ae115bc7Smrj 437ae115bc7Smrj /* 438ae115bc7Smrj * If VIS_PIXEL mode will be implemented on x86, these following 439ae115bc7Smrj * functions should be re-considered. Now these functions are 440ae115bc7Smrj * unused on x86. 441ae115bc7Smrj */ 442ae115bc7Smrj void 443c9503a49Slq150181 plat_tem_get_inverses(int *inverse, int *inverse_screen) 444c9503a49Slq150181 { 445c9503a49Slq150181 *inverse = 0; 446c9503a49Slq150181 *inverse_screen = 0; 447c9503a49Slq150181 } 448c9503a49Slq150181 449c9503a49Slq150181 void 450ae115bc7Smrj plat_tem_get_prom_font_size(int *charheight, int *windowtop) 451ae115bc7Smrj { 452ae115bc7Smrj *charheight = 0; 453ae115bc7Smrj *windowtop = 0; 454ae115bc7Smrj } 455ae115bc7Smrj 456843e1988Sjohnlev /*ARGSUSED*/ 457ae115bc7Smrj void 458ae115bc7Smrj plat_tem_get_prom_size(size_t *height, size_t *width) 459ae115bc7Smrj { 460843e1988Sjohnlev panic("unimplemented at line %d of %s", __LINE__, __FILE__); 461ae115bc7Smrj } 462ae115bc7Smrj 463ae115bc7Smrj void 464ae115bc7Smrj plat_tem_hide_prom_cursor(void) 465ae115bc7Smrj { 466843e1988Sjohnlev panic("unimplemented at line %d of %s", __LINE__, __FILE__); 467ae115bc7Smrj } 468ae115bc7Smrj 469843e1988Sjohnlev /*ARGSUSED*/ 470ae115bc7Smrj void 471ae115bc7Smrj plat_tem_get_prom_pos(uint32_t *row, uint32_t *col) 472ae115bc7Smrj { 473843e1988Sjohnlev panic("unimplemented at line %d of %s", __LINE__, __FILE__); 474ae115bc7Smrj } 475