Ejemplo n.º 1
0
void PE_create_console( void )
{
    if ( PE_state.video.v_display == GRAPHICS_MODE )
        PE_initialize_console( &PE_state.video, kPEGraphicsMode );
    else
        PE_initialize_console( &PE_state.video, kPETextMode );
}
Ejemplo n.º 2
0
/*
 * cdevsw interface to km driver.
 */
int
kmopen(
    dev_t dev,
    int flag,
    int devtype,
    struct proc *pp)
{
    int rtn;
    int unit;
    struct tty *tp;
    struct winsize *wp;
    int ret;

    unit = minor(dev);
    if(unit >= 1)
        return (ENXIO);

    tp = (struct tty *)&cons;
    tp->t_oproc = kmstart;
    tp->t_param = NULL;
    tp->t_dev = dev;

    if ( !(tp->t_state & TS_ISOPEN) ) {
        tp->t_iflag = TTYDEF_IFLAG;
        tp->t_oflag = TTYDEF_OFLAG;
        tp->t_cflag = (CREAD | CS8 | CLOCAL);
        tp->t_lflag = TTYDEF_LFLAG;
        tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED;
        termioschars(&tp->t_termios);
        ttsetwater(tp);
    } else if ((tp->t_state & TS_XCLUDE) && pp->p_ucred->cr_uid != 0)
        return EBUSY;

    tp->t_state |= TS_CARR_ON; /* lie and say carrier exists and is on. */
    ret = ((*linesw[tp->t_line].l_open)(dev, tp));
    {
        PE_Video video;
        wp = &tp->t_winsize;
        /* Magic numbers.  These are CHARWIDTH and CHARHEIGHT
         * from osfmk/ppc/POWERMAC/video_console.c
         */
        wp->ws_xpixel = 8;
        wp->ws_ypixel = 16;

        if (flag & O_POPUP)
            PE_initialize_console(0, kPETextScreen);

        bzero(&video, sizeof(video));
        PE_current_console(&video);
        if( video.v_width != 0 && video.v_height != 0 ) {
            wp->ws_col = video.v_width / wp->ws_xpixel;
            wp->ws_row = video.v_height / wp->ws_ypixel;
        } else {
            wp->ws_col = 100;
            wp->ws_row = 36;
        }
    }
    return ret;
}
Ejemplo n.º 3
0
/*
 * cdevsw interface to km driver.
 */
int
kmopen(dev_t dev, int flag, __unused int devtype, proc_t pp)
{
	int             unit;
	struct tty     *tp;
	struct winsize *wp;
	int             ret;

	unit = minor(dev);
	if (unit >= 1)
		return (ENXIO);

	tp = km_tty[unit];

	tty_lock(tp);

	tp->t_oproc = kmstart;
	tp->t_param = NULL;
	tp->t_dev = dev;

	if (!(tp->t_state & TS_ISOPEN)) {
		tp->t_iflag = TTYDEF_IFLAG;
		tp->t_oflag = TTYDEF_OFLAG;
		tp->t_cflag = (CREAD | CS8 | CLOCAL);
		tp->t_lflag = TTYDEF_LFLAG;
		tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED;
		termioschars(&tp->t_termios);
		ttsetwater(tp);
	} else if ((tp->t_state & TS_XCLUDE) && proc_suser(pp)) {
		ret = EBUSY;
		goto out;
	}

	tp->t_state |= TS_CARR_ON;	/* lie and say carrier exists and is
					 * on. */
	ret = ((*linesw[tp->t_line].l_open) (dev, tp));
	{
		PE_Video        video;
		wp = &tp->t_winsize;
		/*
		 * Magic numbers.  These are CHARWIDTH and CHARHEIGHT from
		 * pexpert/i386/video_console.c
		 */
		wp->ws_xpixel = 8;
		wp->ws_ypixel = 16;

		tty_unlock(tp);		/* XXX race window */

		if (flag & O_POPUP)
			PE_initialize_console(0, kPETextScreen);

		bzero(&video, sizeof(video));
		PE_current_console(&video);

		tty_lock(tp);

		if (serialmode & SERIALMODE_OUTPUT) {
			wp->ws_col = 80;
			wp->ws_row = 24;
		} else if (video.v_width != 0 && video.v_height != 0) {
			wp->ws_col = video.v_width / wp->ws_xpixel;
			wp->ws_row = video.v_height / wp->ws_ypixel;
		} else {
			wp->ws_col = 100;
			wp->ws_row = 36;
		}
	}

out:
	tty_unlock(tp);

	return ret;
}
Ejemplo n.º 4
0
IOReturn IOPlatformExpert::setConsoleInfo( PE_Video * consoleInfo,
						unsigned int op)
{
    return( PE_initialize_console( consoleInfo, op ));
}