consconfig_dacf.c revision 1b83305cfc332b1e19ad6a194b73b2975e6bf79a
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* This module performs two functions. First, it kicks off the driver loading
* of the console devices during boot in dynamic_console_config().
* The loading of the drivers for the console devices triggers the
* additional device autoconfiguration to link the drivers into the keyboard
* and mouse console streams.
*
* The second function of this module is to provide the dacf functions
* to be called after a driver has attached and before it detaches. For
* example, a driver associated with the keyboard will have kb_config called
* after the driver attaches and kb_unconfig before it detaches. Similar
* configuration actions are performed on behalf of minor nodes representing
* mice. The configuration functions for the attach case take a module
* name as a parameter. The module is pushed on top of the driver during
* the configuration.
*
* Although the dacf framework is used to configure all keyboards and mice,
* its primary function is to allow keyboard and mouse hotplugging.
*
* This module supports multiple keyboards and mice at the same time.
*
* From the kernel perspective, there are roughly three different possible
* console configurations. Across these three configurations, the following
* elements are constant:
* wsconsvp = IWSCN_PATH
* rwsconsvp = WC_PATH
* consms -> msdev
*
* The "->" syntax indicates that the streams device on the right is
* linked under the streams device on the left.
*
* The following lists how the system is configured for different setups:
*
* stdin is a local keyboard. use stdin and stdout as the console.
* sp->cons_input_type = CONSOLE_LOCAL
* rconsvp = IWSCN_PATH
* wc -> conskbd -> kbddev
*
* stdin is not a keyboard and stdin is the same as stdout.
* sp->cons_input_type = CONSOLE_TIP
* wc -> conskbd -> kbddev
*
* stdin is not a keyboard device and it's not the same as stdout.
* assume we have a serial keyboard hooked up and use it along with
* stdout as the console.
* sp->cons_input_type = CONSOLE_SERIAL_KEYBOARD
* rconsvp = IWSCN_PATH
* wc -> stdindev
* conskbd -> kbddev
*
* CAVEAT:
* The above is all true except for one possible Intel configuration.
* If stdin is set to a local keyboard but stdout is set to something
* other than the local display (a tip port for example) stdout will
* still go to the local display. This is an artifact of the console
* implementation on intel.
*/
#include <sys/pathname.h>
#include <sys/ndi_impldefs.h>
#include <sys/ddi_impldefs.h>
#include <sys/ddi_implfuncs.h>
#include <sys/tem_impl.h>
#include <sys/polled_io.h>
#include <sys/consconfig_dacf.h>
/*
* External global variables
*/
extern dev_t rwsconsdev;
/*
* External functions
*/
/*
* Tasks
*/
/*
* Internal functions
*/
static void consconfig_check_phys_kbd(cons_state_t *);
static void flush_usb_serial_buf(void);
/*
* On supported configurations, the firmware defines the keyboard and mouse
* paths. However, during USB development, it is useful to be able to use
* the USB keyboard and mouse on machines without full USB firmware support.
* USB configuration. This module will override the firmware's values
* with these.
*
* NOTE:
* The master copies of these variables in the misc/consconfig module.
* The reason for this is historic. In versions of solaris up to and
* including solaris 9 the conscole configuration code was split into a
* seperate sparc and intel version. These variables were defined
* in misc/consconfig on sparc and dacf/consconfig_dacf on intel.
*
* Unfortunatly the sparc variables were well documented.
* So to aviod breaking either sparc or intel we'll declare the variables
* users may have to continue working.
*
* The variables in misc/consconfig will take precedence over the variables
* found in this file. Since we eventually want to remove the variables
* local to this this file, if the user set them we'll emmit an error
* message telling them they need to set the variables in misc/consconfig
* instead.
*/
static char *usb_kb_path = NULL;
static char *usb_ms_path = NULL;
/*
* Access functions in the misc/consconfig module used to retrieve the
* values of it local usb_kb_path and usb_ms_path variables
*/
extern char *consconfig_get_usb_kb_path();
extern char *consconfig_get_usb_ms_path();
/*
* Local variables used to store the value of the usb_kb_path and
* usb_ms_path variables found in misc/consconfig
*/
static char *consconfig_usb_kb_path = NULL;
static char *consconfig_usb_ms_path = NULL;
/*
* Internal variables
*/
static cons_state_t *consconfig_sp;
/*
* consconfig_errlevel: debug verbosity; smaller numbers are more
* verbose.
*/
int consconfig_errlevel = DPRINT_L3;
/*
* Baud rate table
*/
#define MAX_SPEEDS 24
static struct speed {
char *name;
int code;
} speedtab[MAX_SPEEDS] = {
};
static dacf_op_t kbconfig_op[] = {
{ DACF_OPID_END, NULL },
};
static dacf_op_t msconfig_op[] = {
{ DACF_OPID_END, NULL },
};
static dacf_opset_t opsets[] = {
{ "kb_config", kbconfig_op },
{ "ms_config", msconfig_op },
};
};
&mod_dacfops, /* Type of module */
"Consconfig DACF %I%",
};
struct modlinkage modlinkage = {
};
int
_init(void) {
return (mod_install(&modlinkage));
}
int
_fini(void)
{
/*
* This modules state is held in the kernel by space.c
* allowing this module to be unloaded.
*/
return (mod_remove(&modlinkage));
}
int
{
}
/*PRINTFLIKE2*/
static void consconfig_dprintf(int, const char *, ...)
__KPRINTFLIKE(2);
static void
consconfig_dprintf(int l, const char *fmt, ...)
{
#ifndef DEBUG
if (!l) {
return;
}
#endif /* DEBUG */
if (l < consconfig_errlevel) {
return;
}
}
/*
* Return a property name in /aliases.
* The caller is responsible for freeing the memory.
* The property value is NULL terminated string.
* /aliases exists in OBP >= 2.4.
*/
char *
{
/* OBP >= 2.4 has /aliases */
return (NULL);
return (NULL);
return (buf);
}
/*
* i_consconfig_createvp:
* This routine is a convenience routine that is passed a path and returns
* a vnode.
*/
static vnode_t *
i_consconfig_createvp(char *path)
{
int error;
/* convert an OBP path to a /devices path */
return (NULL);
}
} else {
/* convert a devfs path to a /devices path */
}
if (error)
return (NULL);
return (vp);
}
/*
* consconfig_print_paths:
* Function to print out the various paths
*/
static void
consconfig_print_paths(void)
{
char *path;
if (usb_kb_path != NULL)
"consconfig_dacf:usb_kb_path has been deprecated, "
"use consconfig:usb_kb_path instead");
if (usb_ms_path != NULL)
"consconfig_dacf:usb_ms_path has been deprecated, "
"use consconfig:usb_ms_path instead");
if (consconfig_errlevel > DPRINT_L0)
return;
if (consconfig_usb_kb_path != NULL)
else if (usb_kb_path != NULL)
path = usb_kb_path;
path = plat_kbdpath();
if (consconfig_usb_ms_path != NULL)
else if (usb_ms_path != NULL)
path = usb_ms_path;
path = plat_mousepath();
path = plat_stdinpath();
path = plat_stdoutpath();
path = plat_fbpath();
}
/*
* consconfig_kbd_abort_enable:
* Send the CONSSETABORTENABLE ioctl to the lower layers. This ioctl
* will only be sent to the device if it is the console device.
* This ioctl tells the device to pay attention to abort sequences.
* In the case of kbtrans, this would tell the driver to pay attention
* to the two key abort sequences like STOP-A. In the case of the
* serial keyboard, it would be an abort sequence like a break.
*/
static int
{
return (err);
}
/*
* consconfig_kbd_abort_disable:
* Send CONSSETABORTENABLE ioctl to lower layers. This ioctl
* will only be sent to the device if it is the console device.
* This ioctl tells the physical device to ignore abort sequences,
* and send the sequences up to virtual keyboard(conskbd) so that
* STOP and A (or F1 and A) can be combined.
*/
static int
{
return (err);
}
#ifdef _HAVE_TEM_FIRMWARE
static int
{
int *int_array;
int rv = 0;
return (0); /* warning printed later by common code */
/*
* Here we hold the driver and check "tem-support" property.
* We're doing this with e_ddi_hold_devi_by_dev and
* ddi_prop_lookup_int_array without opening the driver since
* some video cards that don't support the kernel terminal
* emulator could hang or crash if opened too early during
* boot.
*/
sp->cons_fb_path);
return (0);
}
/*
* Check that the tem-support property exists AND that
* it is equal to 1.
*/
DDI_SUCCESS) {
if (nint > 0)
}
return (rv);
}
#endif /* _HAVE_TEM_FIRMWARE */
/*
* consconfig_get_polledio:
* Query the console with the CONSPOLLEDIO ioctl.
* The polled I/O routines are used by debuggers to perform I/O while
* interrupts and normal kernel services are disabled.
*/
static cons_polledio_t *
{
/*
* Setup the ioctl to be sent down to the lower driver.
*/
/*
* Send the ioctl to the driver. The ioctl will wait for
* the response to come back from wc. wc has already issued
* the CONSOPENPOLLEDIO to the lower layer driver.
*/
if (err != 0) {
/*
* If the lower driver does not support polled I/O, then
* return NULL. This will be the case if the driver does
* not handle polled I/O, or OBP is going to handle polled
* I/O for the device.
*/
return (NULL);
}
/*
* Return the polled I/O structure.
*/
return (polled_io);
}
/*
* consconfig_setup_polledio:
* This routine does the setup work for polled I/O. First we get
* the polled_io structure from the lower layers
* and then we register the polled I/O
* callbacks with the debugger that will be using them.
*/
static void
{
return;
/*
* Get the polled io routines so that we can use this
* device with the debuggers.
*/
/*
* If the get polledio failed, then we do not want to throw
* the polled I/O switch.
*/
"consconfig_setup_polledio: get_polledio failed\n");
return;
}
/* Initialize the polled input */
/* Register the callbacks */
"consconfig_setup_polledio: registering callbacks\n");
(void) polled_io_register_callbacks(polled_io, 0);
}
static cons_state_t *
consconfig_state_init(void)
{
int rval;
/* Initialize console information */
/* init external globals */
/*
* Find keyboard, mouse, stdin and stdout devices, if they
* exist on this platform.
*/
if (consconfig_usb_kb_path != NULL) {
} else if (usb_kb_path != NULL) {
} else {
}
if (consconfig_usb_ms_path != NULL) {
} else if (usb_ms_path != NULL) {
} else {
}
/* Identify the stdout driver */
if (sp->cons_stdin_is_kbd &&
} else {
/*
* The standard in device may or may not be the same as
* the keyboard. Even if the keyboard is not the
* standard input, the keyboard console stream will
* still be built if the keyboard alias provided by the
* firmware exists and is valid.
*/
}
if (sp->cons_stdout_is_fb) {
#ifdef _HAVE_TEM_FIRMWARE
/*
* Systems which offer a virtual console must use that
* as a fallback whenever the fb doesn't support tem.
* Such systems cannot render characters to the screen
* using OBP.
*/
if (!sp->cons_tem_supported) {
char *path;
if (plat_virtual_console_path(&path) >= 0) {
sp->cons_stdin_is_kbd = 0;
sp->cons_stdout_is_fb = 0;
"%s doesn't support terminal emulation "
"mode; switching to virtual console.",
sp->cons_fb_path);
}
}
#endif /* _HAVE_TEM_FIRMWARE */
} else {
}
/* Save the pointer for retrieval by the dacf functions */
return (sp);
}
static int
{
/*
* NOTE: we could be in a dacf callback context right now. normally
* it's not legal to call any ldi_open_*() function from this context
* because we're currently holding device tree locks and if the
* ldi_open_*() call could try to acquire other device tree locks
* (to attach the device we're trying to open.) if this happens then
* we could deadlock. To avoid this situation, during initialization
* we made sure to grab a hold on the dip of the device we plan to
* open so that it can never be detached. Then we use
* ldi_open_by_dev() to actually open the device since it will see
* that the device is already attached and held and instead of
* acquire any locks it will only increase the reference count
* on the device.
*/
if (err) {
"unable to open wc device");
return (err);
}
if (err != 0) {
"wc link failed, error %d", err);
}
} else {
if (err != 0) {
"wc unlink failed, error %d", err);
} else {
*muxid = -1;
}
}
return (err);
}
static void
{
int rval;
/*
* Build the wc->conskbd portion of the keyboard console stream.
* Even if no keyboard is attached to the system, the upper
* layer of the stream will be built. If the user attaches
* a keyboard after the system is booted, the keyboard driver
* and module will be linked under conskbd.
*
* Errors are generally ignored here because conskbd and wc
* are pseudo drivers and should be present on the system.
*/
/* open the console keyboard device. will never be closed */
panic("consconfig: unable to open conskbd device");
/*NOTREACHED*/
}
/* open the console mouse device. will never be closed */
panic("consconfig: unable to open consms device");
/*NOTREACHED*/
}
/*
* Get a vnode for the wc device and then grab a hold on the
* device dip so it can never detach. We need to do this now
* because later we'll have to open the wc device in a context
* were it isn't safe to acquire any device tree locks (ie, during
* a dacf callback.)
*/
panic("consconfig: unable to find wc device");
panic("consconfig: unable to hold wc device");
/*
* Build the wc->conskbd portion of the keyboard console stream.
* Even if no keyboard is attached to the system, the upper
* layer of the stream will be built. If the user attaches
* a keyboard after the system is booted, the keyboard driver
* and module will be linked under conskbd.
*
* The act of linking conskbd under wc will cause wc to
* query the lower layers about their polled I/O routines
* using CONSOPENPOLLEDIO. This will fail on this link because
* there is not a physical keyboard linked under conskbd.
*
* Since conskbd and wc are pseudo drivers, errors are
* generally ignored when linking and unlinking them.
*/
/*
* Get a vnode for the redirection device. (It has the
* connection to the workstation console device wired into it,
* so that it's not necessary to establish the connection
* here. If the redirection device is ever generalized to
* handle multiple client devices, it won't be able to
* establish the connection itself, and we'll have to do it
* here.)
*/
panic("consconfig: unable to find iwscn device");
/*NOTREACHED*/
}
if (cons_tem_disable)
return;
#if defined(__x86)
if (sp->cons_stdout_is_fb)
#endif
return;
}
/* make sure the frame buffer device exists */
"cannot find driver for screen device %s",
sp->cons_fb_path);
return;
}
#ifdef _HAVE_TEM_FIRMWARE
/*
* If the underlying fb device doesn't support terminal emulation,
* we don't want to open the wc device (below) because it depends
* on features which aren't available (polled mode io).
*/
if (!sp->cons_tem_supported)
return;
#endif /* _HAVE_TEM_FIRMWARE */
/* tell wc to open the frame buffer device */
"unable to open wc device");
return;
}
else
"consconfig: terminal emulator failed to initialize");
}
static void
{
/*
* Calling ddi_pathname_to_dev_t causes the drivers to be loaded.
* The attaching of the drivers will cause the creation of the
* keyboard and mouse minor nodes, which will in turn trigger the
* dacf framework to call the keyboard and mouse configuration
* tasks. See PSARC/1998/212 for more details about the dacf
* framework.
*
* is written this way and the hardware may depend on this, too.
* It would be better to enforce this by attaching zs in sibling
* order with a driver property, such as ddi-attachall.
*/
}
/*
* On x86, make sure the fb driver is loaded even if we don't use it
* which is required to start Xorg.
*/
#if defined(__x86)
#endif
}
static void
{
if (!sp->cons_stdout_is_fb)
return;
/*
* Console output is a framebuffer.
* Find the framebuffer driver if we can, and make
* ourselves a shadow vnode to track it with.
*/
"Can't find driver for console framebuffer\n");
} else {
/* stdoutdev is valid, of fbvp should exist */
panic("consconfig_load_drivers: "
"unable to find frame buffer device");
/*NOTREACHED*/
}
/* console device is never released */
}
}
/*
* consconfig_prepare_dev:
* Flush the stream, push "pushmod" onto the stream.
* for keyboard, issue the KIOCTRANSABLE ioctl, and
* possible enable abort.
*/
static void
const char *pushmod,
int kbdtranslatable,
int input_type,
int dev_type)
{
/* send a flush down the stream to the keyboard driver */
if (pushmod) {
if (err) {
"can't push streams module \"%s\", error %d",
}
}
return;
if (err) {
"KIOCTRANSABLE failed, error: %d", err);
}
/*
* During boot, dynamic_console_config() will call the
* function to enable abort on the console. If the
* keyboard is hotplugged after boot, check to see if
* the keyboard is the console input. If it is
* enable abort on it.
*/
if (input_type == CONSOLE_LOCAL)
(void) consconfig_kbd_abort_enable(new_lh);
}
/*
* consconfig_relink_conskbd:
* If new_lh is not NULL it should represent a driver with a
* keyboard module pushed on top of it. The driver is then linked
* underneath conskbd. the resulting stream will be
* wc->conskbd->"new_lh driver".
*
* If new_lh is NULL, then an unlink operation is done on conskbd
* that attempts to unlink the stream specified by *muxid.
* the resulting stream will be wc->conskbd.
*/
static int
{
int conskbd_relink = 0;
"conskbd_lh = %p, new_lh = %p, muxid = %x\n",
/*
* If conskbd is linked under wc then temporarily unlink it
* from under wc so that the new_lh stream may be linked under
* conskbd. This has to be done because streams are built bottom
* up and linking a stream under conskbd isn't allowed when
* conskbd is linked under wc.
*/
conskbd_relink = 1;
if (err) {
"wc unlink failed, error %d", err);
return (err);
}
}
/* Link the stream represented by new_lh under conskbd */
if (err != 0) {
"conskbd link failed, error %d", err);
goto relink_failed;
}
} else {
/*
* This will cause the keyboard driver to be closed,
* all modules to be popped, and the keyboard vnode released.
*/
if (err != 0) {
"conskbd unlink failed, error %d", err);
goto relink_failed;
} else {
*muxid = -1;
}
}
if (!conskbd_relink)
return (err);
/*
* Link consbkd back under wc.
*
* The act of linking conskbd back under wc will cause wc
* to query the lower lower layers about their polled I/O
* routines. This time the request will succeed because there
* is a physical keyboard linked under conskbd.
*/
if (err) {
"wc link failed, error %d", err);
}
return (err);
if (!conskbd_relink)
return (err);
/* something went wrong, try to reconnect conskbd back under wc */
return (err);
}
/*
* consconfig_relink_consms:
* If new_lh is not NULL it should represent a driver with a
* mouse module pushed on top of it. The driver is then linked
* underneath consms. the resulting stream will be
* consms->"new_lh driver".
*
* If new_lh is NULL, then an unlink operation is done on consms
* that attempts to unlink the stream specified by *muxid.
*/
static int
{
"consms_lh = %p, new_lh = %p, muxid = %x\n",
if (err != 0) {
"mouse link failed, error %d", err);
}
} else {
/* Tear down the mouse stream */
if (err != 0) {
"mouse unlink failed, error %d", err);
} else {
*muxid = -1;
}
}
return (err);
}
static int
{
int type;
/*
* Now that we know what all the devices are, we can figure out
* what kind of console we have.
*/
if (sp->cons_stdin_is_kbd) {
/* Stdin is from the system keyboard */
/*
* A reliable indicator that we are doing a remote console
* is that stdin and stdout are the same.
* This is probably a tip line.
*/
type = CONSOLE_TIP;
} else {
}
return (type);
}
static void
{
int err;
switch (sp->cons_input_type) {
case CONSOLE_LOCAL:
/*
* The machine is allowed to boot without a keyboard.
* If a user attaches a keyboard later, the keyboard
* will be hooked into the console stream with the dacf
* functions.
*
* The only drivers that look at kbbdev are the
* serial drivers, which looks at kbdev to see if
* they should allow abort on a break. In the absence
* of keyboard, the serial drivers won't be attached
* for any keyboard instance.
*/
/*
* If there is a problem with the keyboard
* during the driver loading, then the polled
* input won't get setup properly if polled
* input is needed. This means that if the
* keyboard is hotplugged, the keyboard would
* work normally, but going down to the
* debugger would not work if polled input is
* required. This field is set here. The next
* time a keyboard is plugged in, the field is
* checked in order to give the next keyboard a
* chance at being registered for console
* input.
*
* Although this code will rarely be needed,
* USB keyboards can be flaky, so this code
* will be useful on the occasion that the
* keyboard doesn't enumerate when the drivers
* are loaded.
*/
}
break;
case CONSOLE_TIP:
/*
* Console device drivers must be able to output
* after being closed.
*/
panic("consconfig_init_input: "
"unable to find stdin device (%s)",
/*NOTREACHED*/
}
break;
case CONSOLE_SERIAL_KEYBOARD:
/*
* Non-keyboard input device, but not rconsdev.
* This is known as the "serial keyboard" case - the
* most likely use is someone has a keyboard attached
* to a serial port (tip) and still has output on a
* framebuffer.
*
* In this case, the serial driver must be linked
* directly beneath wc. Since conskbd was linked
* underneath wc above, first we unlink conskbd.
*/
/*
* Open the serial keyboard, configure it,
* and link it underneath wc.
*/
if (err == 0) {
int rval;
int stdin_muxid;
/* Re-set baud rate */
/* Set baud rate */
if (err) {
"consconfig_init_input: "
"TCSETSF failed, error %d", err);
}
}
/*
* Now link the serial keyboard direcly under wc
* we don't save the returned muxid because we
* don't support changing/hotplugging the console
* keyboard when it is a serial keyboard.
*/
}
break;
default:
panic("consconfig_init_input: "
/*NOTREACHED*/
}
/*
* Use the redirection device/workstation console pair as the "real"
* console if the latter hasn't already been set.
* The workstation console driver needs to see rwsconsvp, but
* all other access should be through the redirecting driver.
*/
}
if (err) {
panic("consconfig_init_input: "
"unable to open console device");
/*NOTREACHED*/
}
/* Enable abort on the console */
(void) consconfig_kbd_abort_enable(new_lh);
/* Now we must close it to make console logins happy */
/* Set up polled input if it is supported by the console device */
if (plat_use_polled_debug()) {
/*
* In the debug case, register the keyboard polled entry
* points, but don't throw the switch in the debugger. This
* allows the polled entry points to be checked by hand
*/
} else {
}
}
/*
* This function kicks off the console configuration.
* Configure keyboard and mouse. Main entry here.
*/
void
dynamic_console_config(void)
{
/* initialize space.c globals */
rwsconsdev = NODEV;
/* Initialize cons_state_t structure and console device paths */
/* Build upper layer of console stream */
/*
* plumb the devices into the console stream
*
* At the conclusion of the ddi_pathname_to_dev_t calls, the keyboard
* and mouse drivers are linked into their respective console
* streams if the pathnames are valid.
*/
/*
* This is legacy special case code for the "cool" virtual console
* for the Starfire project. Starfire has a dummy "ssp-serial"
* node in the OBP device tree and cvc is a pseudo driver.
*/
/*
* Setup the virtual console driver for Starfire
* Note that console I/O will still go through prom for now
* (notice we don't open the driver here). The cvc driver
* During that time, a cvcd daemon will be started that
* will open the cvcredirection driver to facilitate
* the redirection of console I/O from cvc to cvcd.
*/
return;
return;
}
/* initialize framebuffer, console input, and redirection device */
"mousedev %lx, kbddev %lx, fbdev %lx, rconsdev %lx\n",
}
/*
* Start of DACF interfaces
*/
/*
*/
static int
{
int error;
if (error) {
return (DACF_FAILURE);
}
/*
*/
/*
* Tell the physical keyboard driver to send
* the abort sequences up to the virtual keyboard
* driver so that STOP and A (or F1 and A)
* can be applied to different keyboards.
*/
(void) consconfig_kbd_abort_disable(lh);
/* Link the stream underneath conskbd */
} else {
/* Link the stream underneath consms */
}
/*
* At this point, the stream is:
* for keyboard: wc->conskbd->["pushmod"->"kbd_vp driver"]
* for mouse: consms->["module_name"->]"mouse_avp driver"
*/
/* Close the driver stream, it will stay linked under conskbd */
if (error) {
return (DACF_FAILURE);
}
return (DACF_SUCCESS);
}
static int
{
else
}
static int
{
const char *pushmod;
/*
* Retrieve the state information
* Some platforms may use the old-style "consconfig" to configure
* console stream modules but may also support devices that happen
* since the console state structure will not be initialized.
* In that case, these entry points should silently fail and
* permit console to be plumbed later in boot.
*/
return (DACF_FAILURE);
/* Access to the global variables is synchronized */
/*
*/
return (DACF_SUCCESS);
}
/*
* Set the major and minor numbers to 0 so
* kb_unconfig/ms_unconfig won't unconfigure
* this node if it is detached.
*/
return (DACF_FAILURE);
}
/*
* See if there was a problem with the console keyboard during boot.
* If so, try to register polled input for this keyboard.
*/
}
/* Prevent autodetach due to memory pressure */
return (DACF_SUCCESS);
}
static int
{
/*
* Retrieve the state information
* So if there isn't a state available, then this entry point just
* returns. See note in kb_config().
*/
return (DACF_SUCCESS);
/*
*/
return (DACF_SUCCESS);
}
/*
* This dev may be opened physically and then hotplugged out.
*/
}
return (DACF_SUCCESS);
}
/*
* This is the post-attach / pre-detach action function for the keyboard
*/
static int
{
}
static int
{
}
static int
{
}
static int
{
}
/*
* consconfig_link and consconfig_unlink are provided to support
* consms.
* file, it will be unlinked from the virtual one, and when it
* is closed physically, it will be linked back under the virtual
* one.
*/
void
{
char buf[MAXPATHLEN];
return;
return;
}
"(%s) underneath virtual keyboard", buf);
else
"(%s) underneath virtual mouse", buf);
}
}
int
{
int error;
return (DACF_SUCCESS);
return (DACF_FAILURE);
}
/*
* Keep this dev on the list, for this dev is still online.
*/
return (error);
}
/*
* Routine to set baud rate, bits-per-char, parity and stop bits
* on the console line when necessary.
*/
static int
{
char buf[MAXPATHLEN];
int len = MAXPATHLEN;
char name[16];
int ppos, i, j;
char *path;
/*
* First, search for a devalias which matches this dev_t.
* Try all of ttya through ttyz until no such alias
*/
for (i = 0; i < ('z'-'a'); i++) {
return (1);
break; /* Exit loop if found */
}
if (i >= ('z'-'a'))
return (1); /* If we didn't find it, return */
/*
* Now that we know which "tty" this corresponds to, retrieve
* the "ttya-mode" options property, which tells us how to configure
* the line.
*/
for (j = 0; j < sizeof (buf); j++)
buf[j] = 0; /* CROCK! */
return (1); /* if no such option, just return */
/* Clear out options we will be setting */
/*
* Now, parse the string. Wish I could use sscanf().
* Format 9600,8,n,1,-
* baud rate, bits-per-char, parity, stop-bits, ignored
*/
break;
}
"invalid mode string %s", buf);
return (1);
}
for (i = 0; i < MAX_SPEEDS; i++) {
break;
}
if (i >= MAX_SPEEDS) {
"consconfig_setmodes: unrecognized speed in %s", buf);
return (1);
}
/* Found the baud rate, set it */
/* Set bits per character */
case '8':
break;
case '7':
break;
default:
"consconfig_setmodes: illegal bits-per-char %s", buf);
return (1);
}
/* Set parity */
case 'o':
break;
case 'e':
break;
case 'n':
break; /* not enabled. */
default:
return (1);
}
/* Set stop bits */
case '1':
break; /* No extra stop bit */
case '2':
break;
default:
"illegal stop bits %s", buf);
return (1);
}
return (0);
}
/*
* Check to see if underlying keyboard devices are still online,
* if any one is offline now, unlink it.
*/
static void
{
int error;
int rval;
continue;
if (error) {
} else {
}
}
/*
* Remove all disconnected keyboards,
* whose dev is turned into NODEV above.
*/
}
/*
* Remove devices according to dev, which may be NODEV
*/
static void
{
if (prev_prop)
} else {
}
}
}
/*
* Add a dev according to prop
*/
static void
{
}
/*
* Find a device from our list according to dev
*/
static cons_prop_t *
{
break;
}
return (prop);
}
/*
* Free a cons prop associated with a keyboard or mouse
*/
static void
{
if (prop->cp_pushmod)
}
/*
* Boot code can't print to usb serial device. The early boot message
* is saved in a buffer at address indicated by "usb-serial-buf".
* This function flushes the message to the USB serial line
*/
static void
flush_usb_serial_buf(void)
{
int rval;
DDI_PROP_DONTPASS, "usb-serial-buf", 0);
if (usbser_buf == 0)
return;
/*
* console I/O is goes to polled I/O entry points.
*
* If usb-serial doesn't implement polled I/O, we need
* We also push ttcompat and ldterm explicitly to get the
* correct output format (autopush isn't set up yet). We
* ignore push errors because they are non-fatal.
* opened as well.
*/
if (cons_polledio == NULL) {
0, &vp, 0, 0) != 0)
return;
if (rconsvp) {
}
}
/*
* Copy message to a kernel buffer. Various kernel routines
* expect buffer to be above kernelbase
*/
;
}