/* * This function replaces sys/dev/cninit.c * Determine which device is the console using * the PROM "input source" and "output sink". */ void consinit(void) { char buffer[128]; const char *consname = "unknown"; DBPRINT(("consinit()\r\n")); if (cn_tab != &consdev_prom) return; if ((prom_stdin_node = prom_instance_to_package(prom_stdin())) == 0) { printf("WARNING: no PROM stdin\n"); } DBPRINT(("stdin node = %x\r\n", prom_stdin_node)); if ((prom_stdout_node = prom_instance_to_package(prom_stdout())) == 0) printf("WARNING: no PROM stdout\n"); DBPRINT(("stdout package = %x\r\n", prom_stdout_node)); DBPRINT(("buffer @ %p\r\n", buffer)); if (prom_stdin_node != 0 && (prom_getproplen(prom_stdin_node, "keyboard") >= 0)) { #if NUKBD > 0 if ((OF_instance_to_path(prom_stdin(), buffer, sizeof(buffer)) >= 0) && (strstr(buffer, "/usb@") != NULL)) { /* * If we have a USB keyboard, it will show up as (e.g.) * /pci@1f,0/usb@c,3/keyboard@1 (Blade 100) */ consname = "usb-keyboard/display"; ukbd_cnattach(); } else #endif consname = "sun-keyboard/display"; } else if (prom_stdin_node != 0 && (OF_instance_to_path(prom_stdin(), buffer, sizeof(buffer)) >= 0)) { consname = buffer; } DBPRINT(("console is %s\n", consname)); #ifndef DEBUG (void)consname; #endif /* Initialize PROM console */ (*cn_tab->cn_probe)(cn_tab); (*cn_tab->cn_init)(cn_tab); }
/* * This function replaces sys/dev/cninit.c * Determine which device is the console using * the PROM "input source" and "output sink". */ void consinit() { register int chosen; char buffer[128]; extern int stdinnode, fbnode; char *consname = "unknown"; DBPRINT(("consinit()\r\n")); if (cn_tab != &consdev_prom) return; DBPRINT(("setting up stdin\r\n")); chosen = OF_finddevice("/chosen"); OF_getprop(chosen, "stdin", &stdin, sizeof(stdin)); DBPRINT(("stdin instance = %x\r\n", stdin)); if ((stdinnode = OF_instance_to_package(stdin)) == 0) { printf("WARNING: no PROM stdin\n"); } #if NUKBD > 0 else { if (OF_getprop(stdinnode, "compatible", buffer, sizeof(buffer)) != -1 && strncmp("usb", buffer, 3) == 0) ukbd_cnattach(); } #endif DBPRINT(("setting up stdout\r\n")); OF_getprop(chosen, "stdout", &stdout, sizeof(stdout)); DBPRINT(("stdout instance = %x\r\n", stdout)); if ((fbnode = OF_instance_to_package(stdout)) == 0) printf("WARNING: no PROM stdout\n"); DBPRINT(("stdout package = %x\r\n", fbnode)); if (stdinnode && (OF_getproplen(stdinnode,"keyboard") >= 0)) { consname = "keyboard/display"; } else if (fbnode && (OF_instance_to_path(stdin, buffer, sizeof(buffer)) >= 0)) { consname = buffer; } printf("console is %s\n", consname); /* Initialize PROM console */ (*cn_tab->cn_probe)(cn_tab); (*cn_tab->cn_init)(cn_tab); }