summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2013-06-04 02:29:32 +0000
committermpi <mpi@openbsd.org>2013-06-04 02:29:32 +0000
commit1de63ba6fa46b5983a37c7375786eedfa3be41ed (patch)
tree716601a78b81784ff37371cad340a16a7db0b6fa
parentregen (diff)
downloadwireguard-openbsd-1de63ba6fa46b5983a37c7375786eedfa3be41ed.tar.xz
wireguard-openbsd-1de63ba6fa46b5983a37c7375786eedfa3be41ed.zip
Add support for virtual consoles, based on previous work done by kettenis@
for inteldrm(4). ok miod@, kettenis@
-rw-r--r--sys/arch/macppc/conf/GENERIC6
-rw-r--r--sys/arch/macppc/pci/vgafb.c41
-rw-r--r--sys/arch/macppc/pci/vgafbvar.h3
3 files changed, 30 insertions, 20 deletions
diff --git a/sys/arch/macppc/conf/GENERIC b/sys/arch/macppc/conf/GENERIC
index 1d305e97e74..5b90b3f96f5 100644
--- a/sys/arch/macppc/conf/GENERIC
+++ b/sys/arch/macppc/conf/GENERIC
@@ -1,4 +1,4 @@
-# $OpenBSD: GENERIC,v 1.218 2013/05/31 19:32:30 mpi Exp $g
+# $OpenBSD: GENERIC,v 1.219 2013/06/04 02:29:32 mpi Exp $g
#
# For further information on compiling OpenBSD kernels, see the config(8)
# man page.
@@ -23,7 +23,11 @@ option USBVERBOSE
option ADBVERBOSE
option ALTIVEC
option APERTURE # in-kernel aperture driver for XFree86
+
+option WSDISPLAY_COMPAT_USL # VT handling
option WSDISPLAY_COMPAT_RAWKBD # provide raw scancodes; needed for X11
+option WSDISPLAY_DEFAULTSCREENS=6 # initial number of text consoles
+option WSDISPLAY_COMPAT_PCVT # emulate some ioctls; needed for X11
option USER_PCICONF # user-space PCI configuration
diff --git a/sys/arch/macppc/pci/vgafb.c b/sys/arch/macppc/pci/vgafb.c
index b0ff2f60c6e..ac8c3cbee45 100644
--- a/sys/arch/macppc/pci/vgafb.c
+++ b/sys/arch/macppc/pci/vgafb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vgafb.c,v 1.46 2013/06/04 02:26:36 mpi Exp $ */
+/* $OpenBSD: vgafb.c,v 1.47 2013/06/04 02:29:32 mpi Exp $ */
/* $NetBSD: vga.c,v 1.3 1996/12/02 22:24:54 cgd Exp $ */
/*
@@ -128,6 +128,19 @@ vgafb_wsdisplay_attach(struct device *parent, struct vga_config *vc,
{
struct wsemuldisplaydev_attach_args aa;
+ /* Setup virtual console now that we can allocate resources. */
+ if (console) {
+ struct rasops_info *ri = &vc->ri;
+ long defattr;
+
+ ri->ri_flg |= RI_VCONS;
+ rasops_init(ri, 160, 160);
+
+ ri->ri_ops.alloc_attr(ri->ri_active, 0, 0, 0, &defattr);
+ wsdisplay_cnattach(&vgafb_stdscreen, ri->ri_active,
+ 0, 0, defattr);
+ }
+
aa.console = console;
aa.scrdata = &vgafb_screenlist;
aa.accessops = &vgafb_accessops;
@@ -318,7 +331,6 @@ vgafb_cnattach(bus_space_tag_t iot, bus_space_tag_t memt, int type, int check)
ri->ri_ops.alloc_attr(ri, 0, 0, 0, &defattr);
wsdisplay_cnattach(&vgafb_stdscreen, ri, 0, 0, defattr);
- vc->nscreens++;
return (0);
}
@@ -424,32 +436,27 @@ vgafb_alloc_screen(void *v, const struct wsscreen_descr *type, void **cookiep,
struct vga_config *vc = v;
struct rasops_info *ri = &vc->ri;
- if (vc->nscreens > 0)
- return (ENOMEM);
-
- *cookiep = ri;
- *curxp = 0;
- *curyp = 0;
- ri->ri_ops.alloc_attr(ri, 0, 0, 0, attrp);
- vc->nscreens++;
-
- return (0);
+ return rasops_alloc_screen(ri, cookiep, curxp, curyp, attrp);
}
void
vgafb_free_screen(void *v, void *cookie)
{
struct vga_config *vc = v;
+ struct rasops_info *ri = &vc->ri;
- if (vc == &vgafbcn)
- panic("vgafb_free_screen: console");
-
- vc->nscreens--;
+ return rasops_free_screen(ri, cookie);
}
int
vgafb_show_screen(void *v, void *cookie, int waitok,
void (*cb)(void *, int, int), void *cbarg)
{
- return (0);
+ struct vga_config *vc = v;
+ struct rasops_info *ri = &vc->ri;
+
+ if (cookie == ri->ri_active)
+ return (0);
+
+ return rasops_show_screen(ri, cookie, waitok, cb, cbarg);
}
diff --git a/sys/arch/macppc/pci/vgafbvar.h b/sys/arch/macppc/pci/vgafbvar.h
index 42b9773ec6d..a49396cb977 100644
--- a/sys/arch/macppc/pci/vgafbvar.h
+++ b/sys/arch/macppc/pci/vgafbvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: vgafbvar.h,v 1.18 2013/06/04 02:20:18 mpi Exp $ */
+/* $OpenBSD: vgafbvar.h,v 1.19 2013/06/04 02:29:32 mpi Exp $ */
/* $NetBSD: vgavar.h,v 1.2 1996/11/23 06:06:43 cgd Exp $ */
/*
@@ -49,7 +49,6 @@ struct vga_config {
bus_size_t mmiosize;
int vc_backlight_on;
- int nscreens;
u_int vc_mode;
};