xref: /titanic_53/usr/src/uts/common/io/consconfig.c (revision 281888b30170d9201cff6510aa98cb0a7151b09e)
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
5*281888b3Sjbeck  * Common Development and Distribution License, Version 1.0 only
6*281888b3Sjbeck  * (the "License").  You may not use this file except in compliance
7*281888b3Sjbeck  * 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 /*
23*281888b3Sjbeck  * Copyright 2003 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 /*
307c478bd9Sstevel@tonic-gate  * Console and mouse configuration
317c478bd9Sstevel@tonic-gate  */
327c478bd9Sstevel@tonic-gate 
337c478bd9Sstevel@tonic-gate #include <sys/types.h>
347c478bd9Sstevel@tonic-gate #include <sys/param.h>
357c478bd9Sstevel@tonic-gate #include <sys/cmn_err.h>
367c478bd9Sstevel@tonic-gate #include <sys/user.h>
377c478bd9Sstevel@tonic-gate #include <sys/vfs.h>
387c478bd9Sstevel@tonic-gate #include <sys/vnode.h>
397c478bd9Sstevel@tonic-gate #include <sys/systm.h>
407c478bd9Sstevel@tonic-gate #include <sys/file.h>
417c478bd9Sstevel@tonic-gate #include <sys/klwp.h>
427c478bd9Sstevel@tonic-gate #include <sys/stropts.h>
437c478bd9Sstevel@tonic-gate #include <sys/stream.h>
447c478bd9Sstevel@tonic-gate #include <sys/strsubr.h>
457c478bd9Sstevel@tonic-gate 
467c478bd9Sstevel@tonic-gate #include <sys/consdev.h>
477c478bd9Sstevel@tonic-gate #include <sys/kbio.h>
487c478bd9Sstevel@tonic-gate #include <sys/debug.h>
497c478bd9Sstevel@tonic-gate #include <sys/reboot.h>
507c478bd9Sstevel@tonic-gate #include <sys/termios.h>
517c478bd9Sstevel@tonic-gate 
527c478bd9Sstevel@tonic-gate #include <sys/ddi.h>
537c478bd9Sstevel@tonic-gate #include <sys/sunddi.h>
547c478bd9Sstevel@tonic-gate #include <sys/modctl.h>
557c478bd9Sstevel@tonic-gate #include <sys/ddi_impldefs.h>
567c478bd9Sstevel@tonic-gate 
577c478bd9Sstevel@tonic-gate #include <sys/strsubr.h>
587c478bd9Sstevel@tonic-gate #include <sys/errno.h>
597c478bd9Sstevel@tonic-gate #include <sys/devops.h>
607c478bd9Sstevel@tonic-gate #include <sys/note.h>
61*281888b3Sjbeck 
627c478bd9Sstevel@tonic-gate 
637c478bd9Sstevel@tonic-gate /*
647c478bd9Sstevel@tonic-gate  * On supported configurations, the firmware defines the keyboard and mouse
657c478bd9Sstevel@tonic-gate  * paths.  However, during USB development, it is useful to be able to use
667c478bd9Sstevel@tonic-gate  * the USB keyboard and mouse on machines without full USB firmware support.
677c478bd9Sstevel@tonic-gate  * These variables may be set in /etc/system according to a machine's
687c478bd9Sstevel@tonic-gate  * USB configuration.  This module will override the firmware's values
697c478bd9Sstevel@tonic-gate  * with these.
707c478bd9Sstevel@tonic-gate  */
717c478bd9Sstevel@tonic-gate static char *usb_kb_path = NULL;
727c478bd9Sstevel@tonic-gate static char *usb_ms_path = NULL;
737c478bd9Sstevel@tonic-gate 
747c478bd9Sstevel@tonic-gate /*
757c478bd9Sstevel@tonic-gate  * This is the loadable module wrapper.
767c478bd9Sstevel@tonic-gate  */
777c478bd9Sstevel@tonic-gate extern struct mod_ops mod_miscops;
787c478bd9Sstevel@tonic-gate 
797c478bd9Sstevel@tonic-gate /*
807c478bd9Sstevel@tonic-gate  * Module linkage information for the kernel.
817c478bd9Sstevel@tonic-gate  */
827c478bd9Sstevel@tonic-gate static struct modlmisc modlmisc = {
837c478bd9Sstevel@tonic-gate 	&mod_miscops, "console configuration %I%"
847c478bd9Sstevel@tonic-gate };
857c478bd9Sstevel@tonic-gate 
867c478bd9Sstevel@tonic-gate static struct modlinkage modlinkage = {
877c478bd9Sstevel@tonic-gate 	MODREV_1, (void *)&modlmisc, NULL
887c478bd9Sstevel@tonic-gate };
897c478bd9Sstevel@tonic-gate 
907c478bd9Sstevel@tonic-gate int
917c478bd9Sstevel@tonic-gate _init(void)
927c478bd9Sstevel@tonic-gate {
937c478bd9Sstevel@tonic-gate 	return (mod_install(&modlinkage));
947c478bd9Sstevel@tonic-gate }
957c478bd9Sstevel@tonic-gate 
967c478bd9Sstevel@tonic-gate int
977c478bd9Sstevel@tonic-gate _fini(void)
987c478bd9Sstevel@tonic-gate {
997c478bd9Sstevel@tonic-gate 	return (mod_remove(&modlinkage));
1007c478bd9Sstevel@tonic-gate }
1017c478bd9Sstevel@tonic-gate 
1027c478bd9Sstevel@tonic-gate int
1037c478bd9Sstevel@tonic-gate _info(struct modinfo *modinfop)
1047c478bd9Sstevel@tonic-gate {
1057c478bd9Sstevel@tonic-gate 	return (mod_info(&modlinkage, modinfop));
1067c478bd9Sstevel@tonic-gate }
1077c478bd9Sstevel@tonic-gate 
1087c478bd9Sstevel@tonic-gate extern void dynamic_console_config(void);
1097c478bd9Sstevel@tonic-gate 
1107c478bd9Sstevel@tonic-gate /*
1117c478bd9Sstevel@tonic-gate  * Configure keyboard and mouse. Main entry here.
1127c478bd9Sstevel@tonic-gate  */
1137c478bd9Sstevel@tonic-gate void
1147c478bd9Sstevel@tonic-gate consconfig(void)
1157c478bd9Sstevel@tonic-gate {
1167c478bd9Sstevel@tonic-gate 	dynamic_console_config();
1177c478bd9Sstevel@tonic-gate }
1187c478bd9Sstevel@tonic-gate 
1197c478bd9Sstevel@tonic-gate extern char *
1207c478bd9Sstevel@tonic-gate consconfig_get_usb_kb_path(void) {
1217c478bd9Sstevel@tonic-gate 	if (usb_kb_path)
1227c478bd9Sstevel@tonic-gate 		return (i_ddi_strdup(usb_kb_path, KM_SLEEP));
1237c478bd9Sstevel@tonic-gate 	return (NULL);
1247c478bd9Sstevel@tonic-gate }
1257c478bd9Sstevel@tonic-gate 
1267c478bd9Sstevel@tonic-gate extern char *
1277c478bd9Sstevel@tonic-gate consconfig_get_usb_ms_path(void) {
1287c478bd9Sstevel@tonic-gate 	if (usb_ms_path)
1297c478bd9Sstevel@tonic-gate 		return (i_ddi_strdup(usb_ms_path, KM_SLEEP));
1307c478bd9Sstevel@tonic-gate 	return (NULL);
1317c478bd9Sstevel@tonic-gate }
132