/*
* 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 (c) 2012 Gary Mills
*
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* isa-specific console configuration routines
*/
#include <sys/ddi_impldefs.h>
#if defined(__xpv)
#include <sys/hypervisor.h>
#include <sys/boot_console.h>
#endif
extern int pseudo_isa;
int
return (0);
}
int
return (0);
}
#ifndef CONS_INVALID
#define CONS_SCREEN_TEXT 0
#endif /* CONS_INVALID */
char *plat_fbpath(void);
static int
{
static int tty_num = 0;
char *cons;
/* If we already have determined the console, just return it. */
if (boot_console != CONS_INVALID) {
return (boot_console);
}
#if defined(__xpv)
return (boot_console);
}
#endif /* __xpv */
/*
* console is defined by "console" property, with
* fallback on the old "input-device" property.
* If "input-device" is not defined either, also check "output-device".
*/
root = ddi_root_node();
(void) i_ddi_attach_hw_nodes("ehci");
(void) i_ddi_attach_hw_nodes("uhci");
(void) i_ddi_attach_hw_nodes("ohci");
/*
* USB device enumerate asynchronously.
* Wait 2 seconds for USB serial devices to attach.
*/
#if defined(__xpv)
#endif /* __xpv */
}
}
/*
* If the console is configured to use a framebuffer but none
* could be found, fallback to "ttya" since it's likely to exist
* and it matches longstanding behavior on SPARC.
*/
tty_num = 0;
}
return (boot_console);
}
int
plat_stdin_is_keyboard(void)
{
}
int
{
}
static char *
{
return (NULL);
return (NULL);
return (NULL);
return (NULL);
return (path);
}
/*
* Return generic path to keyboard device from the alias.
*/
char *
plat_kbdpath(void)
{
/*
* Hardcode to isa keyboard path
* XXX make it settable via bootprop?
*/
if (pseudo_isa)
return (NULL);
return (kbpath);
}
/*
* NOTE: this function is duplicated here and in gfx_private/vgatext while
* we work on a set of commitable interfaces to sunpci.c.
*
* Use the class code to determine if the device is a PCI-to-PCI bridge.
* Returns: B_TRUE if the device is a bridge.
* B_FALSE if the device is not a bridge or the property cannot be
* retrieved.
*/
static boolean_t
{
return (B_FALSE);
class_code &= 0x00ffff00;
return (B_TRUE);
return (B_FALSE);
}
/*
* Type for the parameter of find_fb_dev()
*/
struct find_fb_dev_param
{
};
/*
* The VGA device could be under a subtractive PCI bridge on some systems.
* Though the PCI_BCNF_BCNTRL_VGA_ENABLE bit is not set on such subtractive
* PCI bridge, the subtractive PCI bridge can forward VGA access if no other
* agent claims the access.
* The vga_enable element in param acts as a flag, if not set, ignore the
* checking for the PCI_BCNF_BCNTRL_VGA_ENABLE bit of the PCI bridge during
* the search.
*/
static int
{
struct find_fb_dev_param *p = param;
char *dev_type;
char *parent_type;
if (dip == ddi_root_node())
return (DDI_WALK_CONTINUE);
return (DDI_WALK_PRUNECHILD);
return (DDI_WALK_CONTINUE);
}
char *nodename;
if (!p->vga_enable)
return (DDI_WALK_CONTINUE);
/*
* If the node is not a PCI-to-PCI bridge, continue traversing
* (it could be the root node), otherwise, check for the
* VGAEnable bit to be set in the Bridge Control Register.
*/
return (DDI_WALK_CONTINUE);
}
return (DDI_WALK_PRUNECHILD);
return (DDI_WALK_PRUNECHILD);
if (data16 & PCI_BCNF_BCNTRL_VGA_ENABLE)
return (DDI_WALK_CONTINUE);
return (DDI_WALK_PRUNECHILD);
}
return (DDI_WALK_CONTINUE);
}
return (DDI_WALK_PRUNECHILD);
return (DDI_WALK_PRUNECHILD);
return (DDI_WALK_TERMINATE);
}
return (DDI_WALK_PRUNECHILD);
return (DDI_WALK_PRUNECHILD);
if (!(data16 & PCI_COMM_IO))
return (DDI_WALK_PRUNECHILD);
return (DDI_WALK_TERMINATE);
}
return (DDI_WALK_PRUNECHILD);
}
/*
* The first round search is to find:
* 1) a VGA device.
* 2) a PCI VGA compatible device whose IO space is enabled
* and the VGA Enable bit of any PCI-PCI bridge above it is set.
* If the first round search succeeds, prune the second round search.
*
* The second round seach does not check the VGA Enable bit.
*
* Return the device path as the console fb path.
*/
char *
plat_fbpath(void)
{
/* first round search */
fbpath = fbpath_buf;
return (fbpath);
}
/*
* second round search, do not check the
* PCI_BCNF_BCNTRL_VGA_ENABLE bit
*/
param.vga_enable = 0;
return (NULL);
fbpath = fbpath_buf;
return (fbpath);
}
char *
plat_mousepath(void)
{
/*
* Hardcode to isa mouse path
* XXX make it settable via bootprop?
*/
if (pseudo_isa)
return (NULL);
return (mpath);
}
/* return path of first usb serial device */
static char *
plat_usbser_path(void)
{
extern dev_info_t *usbser_first_device(void);
if (us_path)
return (us_path);
return (NULL);
return (us_path);
}
static char *
{
static char *defaultpath[] = {
};
char *bp;
if (pseudo_isa)
return (defaultpath[inum]);
return (NULL);
return (NULL);
return (NULL);
break;
}
return (NULL);
return (path);
}
/*
* Another possible enhancement could be to use properties
* for the port mapping rather than simply hard-code them.
*/
char *
plat_stdinpath(void)
{
int tty_num = 0;
switch (console_type(&tty_num)) {
#if defined(__xpv)
case CONS_HYPERVISOR:
#endif /* __xpv */
case CONS_TTY:
return (plat_ttypath(tty_num));
case CONS_USBSER:
return (plat_usbser_path());
case CONS_SCREEN_TEXT:
default:
break;
};
return (plat_kbdpath());
}
char *
plat_stdoutpath(void)
{
int tty_num = 0;
switch (console_type(&tty_num)) {
#if defined(__xpv)
case CONS_HYPERVISOR:
#endif /* __xpv */
case CONS_TTY:
return (plat_ttypath(tty_num));
case CONS_USBSER:
return (plat_usbser_path());
case CONS_SCREEN_TEXT:
default:
break;
};
return (plat_fbpath());
}
/*
* If VIS_PIXEL mode will be implemented on x86, these following
* functions should be re-considered. Now these functions are
* unused on x86.
*/
void
{
*inverse = 0;
*inverse_screen = 0;
}
void
{
*charheight = 0;
*windowtop = 0;
}
/*ARGSUSED*/
void
{
}
void
{
}
/*ARGSUSED*/
void
{
}