summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr/src/uts/common/io/consconfig.c9
-rw-r--r--usr/src/uts/common/io/consconfig_dacf.c36
-rw-r--r--usr/src/uts/common/io/kb8042/kb8042.c18
-rw-r--r--usr/src/uts/common/io/kbtrans/kbtrans_streams.c20
-rw-r--r--usr/src/uts/common/sys/kd.h3
-rw-r--r--usr/src/uts/i86pc/boot/boot_console.c23
-rw-r--r--usr/src/uts/i86pc/io/gfx_private/gfxp_vgatext.c152
-rw-r--r--usr/src/uts/i86pc/os/fakebop.c8
-rw-r--r--usr/src/uts/i86pc/os/graphics.c36
-rw-r--r--usr/src/uts/intel/ia32/ml/modstubs.s1
-rw-r--r--usr/src/uts/intel/io/vgatext/vgatext.c121
-rw-r--r--usr/src/uts/sun4/os/machdep.c10
12 files changed, 295 insertions, 142 deletions
diff --git a/usr/src/uts/common/io/consconfig.c b/usr/src/uts/common/io/consconfig.c
index a95254cb21..10a72c0d0d 100644
--- a/usr/src/uts/common/io/consconfig.c
+++ b/usr/src/uts/common/io/consconfig.c
@@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -55,7 +55,7 @@
#include <sys/errno.h>
#include <sys/devops.h>
#include <sys/note.h>
-
+#include <sys/consplat.h>
/*
* On supported configurations, the firmware defines the keyboard and mouse
@@ -126,3 +126,8 @@ consconfig_get_usb_ms_path(void) {
return (i_ddi_strdup(usb_ms_path, KM_SLEEP));
return (NULL);
}
+
+extern char *
+consconfig_get_plat_fbpath(void) {
+ return (plat_fbpath());
+}
diff --git a/usr/src/uts/common/io/consconfig_dacf.c b/usr/src/uts/common/io/consconfig_dacf.c
index d40cd8522e..6766421c2f 100644
--- a/usr/src/uts/common/io/consconfig_dacf.c
+++ b/usr/src/uts/common/io/consconfig_dacf.c
@@ -20,7 +20,7 @@
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -158,7 +158,7 @@ static void consconfig_rem_dev(cons_state_t *, dev_t);
static void consconfig_add_dev(cons_state_t *, cons_prop_t *);
static cons_prop_t *consconfig_find_dev(cons_state_t *, dev_t);
static void consconfig_free_prop(cons_prop_t *prop);
-static void flush_usb_serial_buf(void);
+static void flush_deferred_console_buf(void);
/*
@@ -1497,7 +1497,7 @@ dynamic_console_config(void)
"mousedev %lx, kbddev %lx, fbdev %lx, rconsdev %lx\n",
mousedev, kbddev, fbdev, rconsdev);
- flush_usb_serial_buf();
+ flush_deferred_console_buf();
}
@@ -2059,22 +2059,26 @@ consconfig_free_prop(cons_prop_t *prop)
}
/*
- * 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
+ * The early boot code can't print to a usb serial device or the
+ * graphical boot screen.
+ *
+ * The early boot messages are saved in a buffer at the address indicated
+ * by "deferred-console-buf" This function flushes the message to the
+ * current console now that it is set up.
*/
static void
-flush_usb_serial_buf(void)
+flush_deferred_console_buf(void)
{
int rval;
vnode_t *vp;
- uint_t usbser_buf;
- char *kc, *bc, *usbser_kern_buf;
+ uint_t defcons_buf;
+ char *kc, *bc, *defcons_kern_buf;
- usbser_buf = ddi_prop_get_int(DDI_DEV_T_ANY, ddi_root_node(),
- DDI_PROP_DONTPASS, "usb-serial-buf", 0);
+ /* defcons_buf is in low memory, so an int works here */
+ defcons_buf = ddi_prop_get_int(DDI_DEV_T_ANY, ddi_root_node(),
+ DDI_PROP_DONTPASS, "deferred-console-buf", 0);
- if (usbser_buf == 0)
+ if (defcons_buf == 0)
return;
/*
@@ -2107,13 +2111,13 @@ flush_usb_serial_buf(void)
* Copy message to a kernel buffer. Various kernel routines
* expect buffer to be above kernelbase
*/
- kc = usbser_kern_buf = (char *)kmem_zalloc(MMU_PAGESIZE, KM_SLEEP);
- bc = (char *)(uintptr_t)usbser_buf;
+ kc = defcons_kern_buf = (char *)kmem_zalloc(MMU_PAGESIZE, KM_SLEEP);
+ bc = (char *)(uintptr_t)defcons_buf;
while (*kc++ = *bc++)
;
- console_printf("%s", usbser_kern_buf);
+ console_printf("%s", defcons_kern_buf);
- kmem_free(usbser_kern_buf, MMU_PAGESIZE);
+ kmem_free(defcons_kern_buf, MMU_PAGESIZE);
}
boolean_t
diff --git a/usr/src/uts/common/io/kb8042/kb8042.c b/usr/src/uts/common/io/kb8042/kb8042.c
index 560557934d..396d1c9b08 100644
--- a/usr/src/uts/common/io/kb8042/kb8042.c
+++ b/usr/src/uts/common/io/kb8042/kb8042.c
@@ -23,7 +23,7 @@
/* All Rights Reserved */
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -1013,6 +1013,8 @@ kb8042_received_byte(
enum keystate state;
boolean_t synthetic_release_needed;
+ static int attempt_one_reset = 1;
+
#ifdef KD_DEBUG
kb8042_debug_hotkey(scancode);
#endif
@@ -1041,6 +1043,20 @@ kb8042_received_byte(
}
#endif
+ /* trigger switch back to text mode */
+ if (attempt_one_reset == 1) {
+ ldi_ident_t li;
+ extern void progressbar_key_abort(ldi_ident_t);
+
+ if (ldi_ident_from_dev(kb8042->w_dev, &li) != 0) {
+ cmn_err(CE_NOTE, "!ldi_ident_from_stream failed");
+ } else {
+ progressbar_key_abort(li);
+ ldi_ident_release(li);
+ }
+ attempt_one_reset = 0;
+ }
+
/*
* Don't know if we want this permanently, but it seems interesting
* for the moment.
diff --git a/usr/src/uts/common/io/kbtrans/kbtrans_streams.c b/usr/src/uts/common/io/kbtrans/kbtrans_streams.c
index fa99e5caac..f601e9566e 100644
--- a/usr/src/uts/common/io/kbtrans/kbtrans_streams.c
+++ b/usr/src/uts/common/io/kbtrans/kbtrans_streams.c
@@ -20,7 +20,7 @@
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -46,6 +46,7 @@
#include <sys/consdev.h>
#include <sys/kbtrans.h>
#include <sys/policy.h>
+#include <sys/sunldi.h>
#include "kbtrans_lower.h"
#include "kbtrans_streams.h"
@@ -447,9 +448,26 @@ kbtrans_streams_key(
struct kbtrans_lower *lower;
struct keyboard *kp;
+ static int attempt_one_reset = 1;
+
lower = &upper->kbtrans_lower;
kp = lower->kbtrans_keyboard;
+ /* trigger switch back to text mode */
+ if (attempt_one_reset == 1) {
+ ldi_ident_t li;
+ extern void progressbar_key_abort(ldi_ident_t);
+
+ if (ldi_ident_from_stream(upper->kbtrans_streams_readq, &li)
+ != 0) {
+ cmn_err(CE_NOTE, "!ldi_ident_from_stream failed");
+ } else {
+ progressbar_key_abort(li);
+ ldi_ident_release(li);
+ }
+ attempt_one_reset = 0;
+ }
+
if (upper->kbtrans_streams_abortable) {
switch (upper->kbtrans_streams_abort_state) {
case ABORT_NORMAL:
diff --git a/usr/src/uts/common/sys/kd.h b/usr/src/uts/common/sys/kd.h
index b34b326a31..447e9374ab 100644
--- a/usr/src/uts/common/sys/kd.h
+++ b/usr/src/uts/common/sys/kd.h
@@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -46,6 +46,7 @@ extern "C" {
#define KDSETMODE (KDIOC|10) /* set text/graphics mode */
#define KD_TEXT 0
#define KD_GRAPHICS 1
+#define KD_RESETTEXT 2
#ifdef __cplusplus
}
diff --git a/usr/src/uts/i86pc/boot/boot_console.c b/usr/src/uts/i86pc/boot/boot_console.c
index a25eadd583..ae496a4ca0 100644
--- a/usr/src/uts/i86pc/boot/boot_console.c
+++ b/usr/src/uts/i86pc/boot/boot_console.c
@@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -44,8 +44,8 @@
#if defined(__xpv)
#include <sys/evtchn_impl.h>
#endif /* __xpv */
-static char *usbser_buf;
-static char *usbser_cur;
+static char *defcons_buf;
+static char *defcons_cur;
#endif /* _BOOT */
#if defined(__xpv)
@@ -711,9 +711,9 @@ bcons_init2(char *inputdev, char *outputdev, char *consoledev)
/*
* USB serial -- we just collect data into a buffer
*/
- if (console == CONS_USBSER) {
- extern void *usbser_init(size_t);
- usbser_buf = usbser_cur = usbser_init(MMU_PAGESIZE);
+ if (console == CONS_USBSER || console == CONS_SCREEN_GRAPHICS) {
+ extern void *defcons_init(size_t);
+ defcons_buf = defcons_cur = defcons_init(MMU_PAGESIZE);
}
}
@@ -746,10 +746,10 @@ bcons_device_change(int new_console)
#endif /* __xpv */
static void
-usbser_putchar(int c)
+defcons_putchar(int c)
{
- if (usbser_cur - usbser_buf < MMU_PAGESIZE)
- *usbser_cur++ = c;
+ if (defcons_cur - defcons_buf < MMU_PAGESIZE)
+ *defcons_cur++ = c;
}
#endif /* _BOOT */
@@ -803,12 +803,11 @@ _doputchar(int c)
screen_putchar(c);
return;
case CONS_SCREEN_GRAPHICS:
- return;
#if !defined(_BOOT)
case CONS_USBSER:
- usbser_putchar(c);
- return;
+ defcons_putchar(c);
#endif /* _BOOT */
+ return;
}
}
diff --git a/usr/src/uts/i86pc/io/gfx_private/gfxp_vgatext.c b/usr/src/uts/i86pc/io/gfx_private/gfxp_vgatext.c
index a9d3c3827e..d8b34dd82a 100644
--- a/usr/src/uts/i86pc/io/gfx_private/gfxp_vgatext.c
+++ b/usr/src/uts/i86pc/io/gfx_private/gfxp_vgatext.c
@@ -20,7 +20,7 @@
*/
/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -28,8 +28,6 @@
/* Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T */
/* All Rights Reserved */
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/errno.h>
#include <sys/types.h>
#include <sys/conf.h>
@@ -49,9 +47,6 @@
#include <sys/kd.h>
#include <sys/ddi_impldefs.h>
-
-
-
#include "gfx_private.h"
#define MYNAME "gfxp_vgatext"
@@ -93,6 +88,7 @@ struct vgatext_softc {
} colormap[VGA8_CMAP_ENTRIES];
unsigned char attrib_palette[VGA_ATR_NUM_PLT];
unsigned int flags;
+ kmutex_t lock;
};
typedef enum pc_colors {
@@ -310,8 +306,6 @@ gfxp_vgatext_attach(dev_info_t *devi, ddi_attach_cmd_t cmd,
char *cons;
int pci_pcie_bus = 0;
-
-
switch (cmd) {
case DDI_ATTACH:
break;
@@ -333,6 +327,8 @@ gfxp_vgatext_attach(dev_info_t *devi, ddi_attach_cmd_t cmd,
softc->polledio.copy = vgatext_polled_copy;
softc->polledio.cursor = vgatext_polled_cursor;
+ mutex_init(&(softc->lock), NULL, MUTEX_DRIVER, NULL);
+
error = ddi_prop_lookup_string(DDI_DEV_T_ANY, ddi_get_parent(devi),
DDI_PROP_DONTPASS, "device_type", &parent_type);
if (error != DDI_SUCCESS) {
@@ -415,22 +411,26 @@ gfxp_vgatext_attach(dev_info_t *devi, ddi_attach_cmd_t cmd,
softc->text_base = (caddr_t)softc->fb.addr + VGA_COLOR_BASE;
else
softc->text_base = (caddr_t)softc->fb.addr + VGA_MONO_BASE;
- softc->current_base = softc->text_base;
-
- error = ddi_prop_create(makedevice(DDI_MAJOR_T_UNKNOWN, unit),
- devi, DDI_PROP_CANSLEEP, DDI_KERNEL_IOCTL, NULL, 0);
- if (error != DDI_SUCCESS)
- goto fail;
if (ddi_prop_lookup_string(DDI_DEV_T_ANY, ddi_root_node(),
DDI_PROP_DONTPASS, "console", &cons) == DDI_SUCCESS) {
if (strcmp(cons, "graphics") == 0) {
happyface_boot = 1;
vgatext_silent = 1;
+ softc->current_base = softc->shadow;
+ } else {
+ softc->current_base = softc->text_base;
}
ddi_prop_free(cons);
+ } else {
+ softc->current_base = softc->text_base;
}
+ error = ddi_prop_create(makedevice(DDI_MAJOR_T_UNKNOWN, unit),
+ devi, DDI_PROP_CANSLEEP, DDI_KERNEL_IOCTL, NULL, 0);
+ if (error != DDI_SUCCESS)
+ goto fail;
+
gfxp_check_for_console(devi, softc, pci_pcie_bus);
/* only do this if not in graphics mode */
@@ -455,10 +455,6 @@ gfxp_vgatext_detach(dev_info_t *devi, ddi_detach_cmd_t cmd,
{
struct vgatext_softc *softc = (struct vgatext_softc *)ptr;
-
-
-
-
switch (cmd) {
case DDI_SUSPEND:
@@ -469,6 +465,7 @@ gfxp_vgatext_detach(dev_info_t *devi, ddi_detach_cmd_t cmd,
ddi_regs_map_free(&softc->fb.handle);
if (softc->regs.mapped)
ddi_regs_map_free(&softc->regs.handle);
+ mutex_destroy(&(softc->lock));
return (DDI_SUCCESS);
default:
@@ -499,18 +496,9 @@ gfxp_vgatext_close(dev_t devp, int flag, int otyp, cred_t *cred,
return (0);
}
-/*ARGSUSED*/
-int
-gfxp_vgatext_ioctl(
- dev_t dev,
- int cmd,
- intptr_t data,
- int mode,
- cred_t *cred,
- int *rval,
- gfxp_vgatext_softc_ptr_t ptr)
+static int
+do_gfx_ioctl(int cmd, intptr_t data, int mode, struct vgatext_softc *softc)
{
- struct vgatext_softc *softc = (struct vgatext_softc *)ptr;
static char kernel_only[] =
"gfxp_vgatext_ioctl: %s is a kernel only ioctl";
int err;
@@ -611,6 +599,28 @@ gfxp_vgatext_ioctl(
return (0);
}
+/*ARGSUSED*/
+int
+gfxp_vgatext_ioctl(
+ dev_t dev,
+ int cmd,
+ intptr_t data,
+ int mode,
+ cred_t *cred,
+ int *rval,
+ gfxp_vgatext_softc_ptr_t ptr)
+{
+ int err;
+
+ struct vgatext_softc *softc = (struct vgatext_softc *)ptr;
+
+ mutex_enter(&(softc->lock));
+ err = do_gfx_ioctl(cmd, data, mode, softc);
+ mutex_exit(&(softc->lock));
+
+ return (err);
+}
+
/*
* vgatext_save_text
* vgatext_restore_textmode
@@ -629,7 +639,7 @@ vgatext_save_text(struct vgatext_softc *softc)
unsigned i;
for (i = 0; i < sizeof (softc->shadow); i++)
- softc->shadow[i] = softc->text_base[i];
+ softc->shadow[i] = softc->current_base[i];
}
static void
@@ -697,49 +707,76 @@ vgatext_resume(struct vgatext_softc *softc)
}
}
-static int
-vgatext_kdsetmode(struct vgatext_softc *softc, int mode)
+static void
+vgatext_progressbar_stop()
+{
+ extern void progressbar_stop(void);
+
+ if (vgatext_silent == 1) {
+ vgatext_silent = 0;
+ progressbar_stop();
+ }
+}
+
+static void
+vgatext_kdsettext(struct vgatext_softc *softc)
{
int i;
+ vgatext_init(softc);
+ for (i = 0; i < sizeof (softc->shadow); i++) {
+ softc->text_base[i] = softc->shadow[i];
+ }
+ softc->current_base = softc->text_base;
+ if (softc->cursor.visible) {
+ vgatext_set_cursor(softc,
+ softc->cursor.row, softc->cursor.col);
+ }
+ vgatext_restore_colormap(softc);
+}
+
+static void
+vgatext_kdsetgraphics(struct vgatext_softc *softc)
+{
+ vgatext_progressbar_stop();
+ vgatext_save_text(softc);
+ softc->current_base = softc->shadow;
+#if defined(USE_BORDERS)
+ vgatext_init_graphics(softc);
+#endif
+}
+
+static int
+vgatext_kdsetmode(struct vgatext_softc *softc, int mode)
+{
if ((mode == softc->mode) || (!GFXP_IS_CONSOLE(softc)))
return (0);
switch (mode) {
case KD_TEXT:
- vgatext_init(softc);
- for (i = 0; i < sizeof (softc->shadow); i++) {
- softc->text_base[i] = softc->shadow[i];
- }
- softc->current_base = softc->text_base;
- if (softc->cursor.visible) {
- vgatext_set_cursor(softc,
- softc->cursor.row, softc->cursor.col);
- }
- vgatext_restore_colormap(softc);
+ vgatext_kdsettext(softc);
break;
case KD_GRAPHICS:
+ vgatext_kdsetgraphics(softc);
+ break;
-
- if (vgatext_silent == 1) {
- extern void progressbar_stop(void);
-
- vgatext_silent = 0;
- progressbar_stop();
+ case KD_RESETTEXT:
+ /*
+ * In order to avoid racing with a starting X server,
+ * this needs to be a test and set that is performed in
+ * a single (softc->lock protected) ioctl into this driver.
+ */
+ if (softc->mode == KD_TEXT && vgatext_silent == 1) {
+ vgatext_progressbar_stop();
+ vgatext_kdsettext(softc);
}
- vgatext_save_text(softc);
-
-
- softc->current_base = softc->shadow;
-#if defined(USE_BORDERS)
- vgatext_init_graphics(softc);
-#endif
break;
default:
return (EINVAL);
}
+
softc->mode = mode;
return (0);
}
@@ -814,8 +851,6 @@ vgatext_cons_display(struct vgatext_softc *softc, struct vis_consdisplay *da)
};
struct cgatext *addr;
- if (vgatext_silent)
- return;
/*
* Sanity checks. This is a last-ditch effort to avoid damage
* from brokenness or maliciousness above.
@@ -867,9 +902,6 @@ vgatext_cons_copy(struct vgatext_softc *softc, struct vis_conscopy *ma)
screen_size_t rows_to_move;
unsigned short *base;
- if (vgatext_silent)
- return;
-
/*
* Sanity checks. Note that this is a last-ditch effort to avoid
* damage caused by broken-ness or maliciousness above.
diff --git a/usr/src/uts/i86pc/os/fakebop.c b/usr/src/uts/i86pc/os/fakebop.c
index bbb85856e7..41fb4525d3 100644
--- a/usr/src/uts/i86pc/os/fakebop.c
+++ b/usr/src/uts/i86pc/os/fakebop.c
@@ -2146,16 +2146,18 @@ build_firmware_properties(void)
}
/*
- * fake up a boot property for USB serial console early boot output
+ * fake up a boot property for deferred early console output
+ * this is used by both graphical boot and the (developer only)
+ * USB serial console
*/
void *
-usbser_init(size_t size)
+defcons_init(size_t size)
{
static char *p = NULL;
p = do_bsys_alloc(NULL, NULL, size, MMU_PAGESIZE);
*p = 0;
- bsetprop("usb-serial-buf", strlen("usb-serial-buf") + 1,
+ bsetprop("deferred-console-buf", strlen("deferred-console-buf") + 1,
&p, sizeof (p));
return (p);
}
diff --git a/usr/src/uts/i86pc/os/graphics.c b/usr/src/uts/i86pc/os/graphics.c
index 70d6301fa2..c60ae37c6f 100644
--- a/usr/src/uts/i86pc/os/graphics.c
+++ b/usr/src/uts/i86pc/os/graphics.c
@@ -19,12 +19,10 @@
* CDDL HEADER END
*/
/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/types.h>
#include <sys/systm.h>
#include <sys/bootconf.h>
@@ -32,6 +30,9 @@
#include <sys/ddi.h>
#include <sys/sunddi.h>
#include <vm/seg_kmem.h>
+#include <sys/file.h>
+#include <sys/kd.h>
+#include <sys/sunldi.h>
#define VIDEOMEM 0xa0000
@@ -191,3 +192,32 @@ progressbar_stop(void)
vmem_free(heap_arena, videomem, videomem_size);
#endif
}
+
+/*ARGSUSED*/
+void
+progressbar_key_abort(ldi_ident_t li)
+{
+#if !defined(__xpv)
+ char *fbpath;
+ int ret;
+ ldi_handle_t hdl;
+
+ extern char *consconfig_get_plat_fbpath(void);
+
+ if (graphics_mode == 0)
+ return;
+
+ fbpath = consconfig_get_plat_fbpath();
+
+ if (ldi_open_by_name(fbpath, FWRITE, kcred, &hdl, li) != 0) {
+ cmn_err(CE_NOTE, "!ldi_open_by_name failed");
+ } else {
+ if (ldi_ioctl(hdl, KDSETMODE, KD_RESETTEXT, FKIOCTL,
+ kcred, &ret)
+ != 0)
+ cmn_err(CE_NOTE,
+ "!ldi_ioctl for KD_RESETTEXT failed");
+ (void) ldi_close(hdl, NULL, kcred);
+ }
+#endif
+}
diff --git a/usr/src/uts/intel/ia32/ml/modstubs.s b/usr/src/uts/intel/ia32/ml/modstubs.s
index 3b050716c0..4ee5540a8c 100644
--- a/usr/src/uts/intel/ia32/ml/modstubs.s
+++ b/usr/src/uts/intel/ia32/ml/modstubs.s
@@ -849,6 +849,7 @@ fcnname/**/_info: \
STUB(consconfig, consconfig, 0);
STUB(consconfig, consconfig_get_usb_kb_path, 0);
STUB(consconfig, consconfig_get_usb_ms_path, 0);
+ STUB(consconfig, consconfig_get_plat_fbpath, 0);
END_MODULE(consconfig);
#endif
diff --git a/usr/src/uts/intel/io/vgatext/vgatext.c b/usr/src/uts/intel/io/vgatext/vgatext.c
index af9f01402d..2a60ebe5bd 100644
--- a/usr/src/uts/intel/io/vgatext/vgatext.c
+++ b/usr/src/uts/intel/io/vgatext/vgatext.c
@@ -20,7 +20,7 @@
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -161,9 +161,10 @@ struct vgatext_softc {
unsigned char blue;
} colormap[VGA8_CMAP_ENTRIES];
unsigned char attrib_palette[VGA_ATR_NUM_PLT];
- agp_master_softc_t *agp_master; /* NULL mean not PCI, for AGP */
+ agp_master_softc_t *agp_master; /* NULL means not PCI, for AGP */
ddi_acc_handle_t *pci_cfg_hdlp; /* PCI conf handle */
unsigned int flags;
+ kmutex_t lock;
};
#define VGATEXT_FLAG_CONSOLE 0x00000001
@@ -449,6 +450,8 @@ vgatext_attach(dev_info_t *devi, ddi_attach_cmd_t cmd)
softc->polledio.copy = vgatext_polled_copy;
softc->polledio.cursor = vgatext_polled_cursor;
+ mutex_init(&(softc->lock), NULL, MUTEX_DRIVER, NULL);
+
error = ddi_prop_lookup_string(DDI_DEV_T_ANY, ddi_get_parent(devi),
DDI_PROP_DONTPASS, "device_type", &parent_type);
if (error != DDI_SUCCESS) {
@@ -527,7 +530,20 @@ vgatext_attach(dev_info_t *devi, ddi_attach_cmd_t cmd)
softc->text_base = (caddr_t)softc->fb.addr + VGA_COLOR_BASE;
else
softc->text_base = (caddr_t)softc->fb.addr + VGA_MONO_BASE;
- softc->current_base = softc->text_base;
+
+ if (ddi_prop_lookup_string(DDI_DEV_T_ANY, ddi_root_node(),
+ DDI_PROP_DONTPASS, "console", &cons) == DDI_SUCCESS) {
+ if (strcmp(cons, "graphics") == 0) {
+ happyface_boot = 1;
+ vgatext_silent = 1;
+ softc->current_base = softc->shadow;
+ } else {
+ softc->current_base = softc->text_base;
+ }
+ ddi_prop_free(cons);
+ } else {
+ softc->current_base = softc->text_base;
+ }
(void) sprintf(buf, "text-%d", unit);
error = ddi_create_minor_node(devi, buf, S_IFCHR,
@@ -540,15 +556,6 @@ vgatext_attach(dev_info_t *devi, ddi_attach_cmd_t cmd)
if (error != DDI_SUCCESS)
goto fail;
- if (ddi_prop_lookup_string(DDI_DEV_T_ANY, ddi_root_node(),
- DDI_PROP_DONTPASS, "console", &cons) == DDI_SUCCESS) {
- if (strcmp(cons, "graphics") == 0) {
- happyface_boot = 1;
- vgatext_silent = 1;
- }
- ddi_prop_free(cons);
- }
-
vgatext_check_for_console(devi, softc, pci_pcie_bus);
/* only do this if not in graphics mode */
@@ -599,6 +606,7 @@ vgatext_detach(dev_info_t *devi, ddi_detach_cmd_t cmd)
ddi_regs_map_free(&softc->fb.handle);
if (softc->regs.mapped)
ddi_regs_map_free(&softc->regs.handle);
+ mutex_destroy(&(softc->lock));
ddi_remove_minor_node(devi, NULL);
(void) ddi_soft_state_free(vgatext_softc_head, instance);
return (DDI_SUCCESS);
@@ -810,7 +818,9 @@ vgatext_ioctl(
switch (DEV2MINOR(dev)) {
case GFX_MINOR:
+ mutex_enter(&(softc->lock));
err = do_gfx_ioctl(cmd, data, mode, softc);
+ mutex_exit(&(softc->lock));
break;
case AGPMASTER_MINOR:
@@ -823,45 +833,81 @@ vgatext_ioctl(
return (EBADF);
}
return (err);
+}
+
+static void
+vgatext_save_text(struct vgatext_softc *softc)
+{
+ unsigned i;
+ for (i = 0; i < sizeof (softc->shadow); i++)
+ softc->shadow[i] = softc->current_base[i];
}
-static int
-vgatext_kdsetmode(struct vgatext_softc *softc, int mode)
+static void
+vgatext_progressbar_stop()
+{
+ extern void progressbar_stop(void);
+
+ if (vgatext_silent == 1) {
+ vgatext_silent = 0;
+ progressbar_stop();
+ }
+}
+
+static void
+vgatext_kdsettext(struct vgatext_softc *softc)
{
int i;
+ vgatext_init(softc);
+ for (i = 0; i < sizeof (softc->shadow); i++) {
+ softc->text_base[i] = softc->shadow[i];
+ }
+ softc->current_base = softc->text_base;
+ if (softc->cursor.visible) {
+ vgatext_set_cursor(softc,
+ softc->cursor.row, softc->cursor.col);
+ }
+ vgatext_restore_colormap(softc);
+}
+
+static void
+vgatext_kdsetgraphics(struct vgatext_softc *softc)
+{
+ vgatext_progressbar_stop();
+ vgatext_save_text(softc);
+ softc->current_base = softc->shadow;
+#if defined(USE_BORDERS)
+ vgatext_init_graphics(softc);
+#endif
+}
+
+static int
+vgatext_kdsetmode(struct vgatext_softc *softc, int mode)
+{
if ((mode == softc->mode) || (!VGATEXT_IS_CONSOLE(softc)))
return (0);
switch (mode) {
case KD_TEXT:
- vgatext_init(softc);
- for (i = 0; i < sizeof (softc->shadow); i++) {
- softc->text_base[i] = softc->shadow[i];
- }
- softc->current_base = softc->text_base;
- if (softc->cursor.visible) {
- vgatext_set_cursor(softc,
- softc->cursor.row, softc->cursor.col);
- }
- vgatext_restore_colormap(softc);
+ vgatext_kdsettext(softc);
break;
case KD_GRAPHICS:
- if (vgatext_silent == 1) {
- extern void progressbar_stop(void);
+ vgatext_kdsetgraphics(softc);
+ break;
- vgatext_silent = 0;
- progressbar_stop();
- }
- for (i = 0; i < sizeof (softc->shadow); i++) {
- softc->shadow[i] = softc->text_base[i];
+ case KD_RESETTEXT:
+ /*
+ * In order to avoid racing with a starting X server,
+ * this needs to be a test and set that is performed in
+ * a single (softc->lock protected) ioctl into this driver.
+ */
+ if (softc->mode == KD_TEXT && vgatext_silent == 1) {
+ vgatext_progressbar_stop();
+ vgatext_kdsettext(softc);
}
- softc->current_base = softc->shadow;
-#if defined(USE_BORDERS)
- vgatext_init_graphics(softc);
-#endif
break;
default:
@@ -942,8 +988,6 @@ vgatext_cons_display(struct vgatext_softc *softc, struct vis_consdisplay *da)
};
struct cgatext *addr;
- if (vgatext_silent)
- return;
/*
* Sanity checks. This is a last-ditch effort to avoid damage
* from brokenness or maliciousness above.
@@ -995,9 +1039,6 @@ vgatext_cons_copy(struct vgatext_softc *softc, struct vis_conscopy *ma)
screen_size_t rows_to_move;
unsigned short *base;
- if (vgatext_silent)
- return;
-
/*
* Sanity checks. Note that this is a last-ditch effort to avoid
* damage caused by broken-ness or maliciousness above.
diff --git a/usr/src/uts/sun4/os/machdep.c b/usr/src/uts/sun4/os/machdep.c
index 87c87d9179..d90db8d04f 100644
--- a/usr/src/uts/sun4/os/machdep.c
+++ b/usr/src/uts/sun4/os/machdep.c
@@ -19,12 +19,10 @@
* CDDL HEADER END
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/types.h>
#include <sys/kstat.h>
#include <sys/param.h>
@@ -839,3 +837,9 @@ void
plat_release_page(page_t *pp)
{
}
+
+/* ARGSUSED */
+void
+progressbar_key_abort(ldi_ident_t li)
+{
+}