tem.c revision 7af39a24a43cc39d19ea5551d31daf3cdd91eb57
/*
* 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 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ANSI terminal emulator module; parse ANSI X3.64 escape sequences and
* the like.
*/
#include <sys/visual_io.h>
#include <sys/tem_impl.h>
#ifdef _HAVE_TEM_FIRMWARE
#endif /* _HAVE_TEM_FIRMWARE */
#include <sys/consconfig_dacf.h>
/* Terminal emulator functions */
/*
* Globals
*/
extern struct mod_ops mod_miscops;
&mod_miscops, /* modops */
"ANSI Terminal Emulator", /* name */
};
static struct modlinkage modlinkage = {
};
int
_init(void)
{
int ret;
if (ret != 0)
return (ret);
if (ret != 0) {
(void) mod_remove(&modlinkage);
return (ret);
}
return (0);
}
int
_fini()
{
int ret;
if (ret == 0) {
}
return (ret);
}
int
{
}
int
{
int lyr_rval;
/*
* Allow layered on driver to clean up console private
* data.
*/
/*
* Close layered on driver
*/
return (0);
}
static int
{
int lyr_rval;
if (finish_ioctl)
return (ENXIO);
}
static void
{
}
static void
{
}
/*
* This is the main entry point to the module. It handles output requests
* during normal system operation, when (e.g.) mutexes are available.
*/
void
{
}
int
{
struct vis_devinit devinit;
char *pathbuf;
int err = 0;
int lyr_rval;
#ifdef _HAVE_TEM_FIRMWARE
#endif /* _HAVE_TEM_FIRMWARE */
/*
* Open the layered device using the devfs physical device name
* after adding the /devices prefix.
*/
return (ENXIO);
}
return (ENXIO);
}
/*
* Initialize the console and get the device parameters
*/
}
/* Make sure the fb driver and terminal emulator versions match */
"terminal emulator: VIS_CONS_REV %d (see sys/visual_io.h) "
}
"I/O");
}
/* other sanity checks */
}
}
}
/*
* Initialize the terminal emulator
*/
return (err);
}
/*
* On SPARC don't clear the screen if the console is the framebuffer.
* Otherwise it needs to be cleared to get rid of junk that may be
* in frameuffer memory, since the screen isn't cleared when
* boot messages are directed elsewhere.
*/
/*
* The old getting current cursor position code, which
* is not needed here, has been in tem_write/tem_polled_write.
*/
} else if (plat_stdout_is_framebuffer()) {
/*
* We are getting the current cursor position in pixel
* mode so that we don't over-write the console output
* during boot.
*/
/*
* Adjust the row if necessary when the font of our
* kernel console tem is different with that of prom
* tem.
*/
/* first line of our kernel console output */
/* re-set and align cusror position */
} else {
}
#ifdef _HAVE_TEM_FIRMWARE
if (plat_stdout_is_framebuffer()) {
/*
* Drivers in the console stream may emit additional
* messages before we are ready. This causes text
* overwrite on the screen. So we set the redirection
* here. It is safe because the ioctl in consconfig_dacf
* will succeed and consmode will be set to CONS_KFB.
*/
}
#endif /* _HAVE_TEM_FIRMWARE */
return (0);
}
/*
* This is a callback function that we register with the frame
* buffer driver layered underneath. It gets invoked from
* the underlying frame buffer driver to reconfigure the terminal
* emulator to a new screen size and depth in conjunction with
* framebuffer videomode changes.
*/
void
{
}
static int
struct vis_devinit *devinit,
{
int i;
case VIS_TEXT:
break;
case VIS_PIXEL:
/*
* First check to see if the user has specified a screen size.
* If so, use those values. Else use 34x80 as the default.
*/
if (width == 0) {
}
/*
* set_font() will select a appropriate sized font for
* the number of rows and columns selected. If we don't
* have a font that will fit, then it will use the
* default builtin font and adjust the rows and columns
* to fit on the screen.
*/
new_state->a_p_offset.y =
new_state->a_p_offset.x =
case 4:
break;
case 8:
break;
case 24:
case 32:
break;
}
break;
default:
/*
* The layered fb driver conveyed an unrecognized rendering
* mode. We cannot proceed with tem initialization.
*/
return (ENXIO);
}
/*
* Change state atomically so that polled I/O requests
* can be safely and reliably serviced anytime after the terminal
* emulator is originally initialized and the console mode has been
* switched over from the PROM, even while a videomode change
* callback is being processed.
*/
if (prev_state != NULL)
return (0);
}
/*
* This function is used to display a rectangular blit of data
* of a given size and location via the underlying framebuffer driver.
* The blit can be as small as a pixel or as large as the screen.
*/
void
struct vis_consdisplay *pda,
{
int rval;
}
/*
* This function is used to invoke a block copy operation in the
* underlying framebuffer driver. Rectangle copies are how scrolling
* is implemented, as well as horizontal text shifting escape seqs.
* such as from vi when deleting characters and words.
*/
void
struct vis_conscopy *pma,
{
int rval;
}
/*
* This function is used to show or hide a rectangluar monochrom
* pixel inverting, text block cursor via the underlying framebuffer.
*/
void
struct vis_conscursor *pca,
{
int rval;
}
void
enum called_from called_from)
{
int rval;
if (called_from == CALLED_FROM_STANDALONE)
return;
case 8:
break;
}
}
void
{
}
void
{
}
/*
* This function is to scroll up the OBP output, which has
* different screen height and width with our kernel console.
*/
static void
{
struct vis_conscopy ma;
/* copy */
/* clear */
0, ncols, 0,
}
#define PROM_DEFAULT_FONT_HEIGHT 22
#define PROM_DEFAULT_WINDOW_TOP 0x8a
/*
* This function is to compute the starting row of the console, according to
* PROM cursor's position. Here we have to take different fonts into account.
*/
static int
{
int tem_row;
int tem_y;
int prom_charheight = 0;
int prom_window_top = 0;
int scroll_up_lines;
if (prom_charheight == 0)
if (prom_window_top == 0)
if (tem_row < 0) {
tem_row = 0;
/*
* Scroll up the prom outputs if the PROM cursor's position is
* below our tem's lower boundary.
*/
}
return (tem_row);
}