Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch Pass the VBE mode number from the bootloader to the...



details:   https://anonhg.NetBSD.org/src/rev/df51a16b575d
branches:  trunk
changeset: 746940:df51a16b575d
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Mon Aug 24 02:15:46 2009 +0000

description:
Pass the VBE mode number from the bootloader to the kernel, and then
make the ACPI wakecode aware of it. Restore the desired VBE mode on resume
when acpi_vbios_reset=1, so suspend/resume with genfb console will work.

diffstat:

 sys/arch/amd64/acpi/acpi_wakecode.S |  16 +++++++++++++++-
 sys/arch/i386/acpi/acpi_wakecode.S  |  18 +++++++++++++++++-
 sys/arch/i386/stand/lib/vbe.c       |   3 ++-
 sys/arch/x86/acpi/acpi_wakeup.c     |   7 +++++--
 sys/arch/x86/include/bootinfo.h     |   5 +++--
 sys/arch/x86/x86/genfb_machdep.c    |  13 +++++++++++--
 6 files changed, 53 insertions(+), 9 deletions(-)

diffs (187 lines):

diff -r 88b5c71028db -r df51a16b575d sys/arch/amd64/acpi/acpi_wakecode.S
--- a/sys/arch/amd64/acpi/acpi_wakecode.S       Mon Aug 24 02:10:41 2009 +0000
+++ b/sys/arch/amd64/acpi/acpi_wakecode.S       Mon Aug 24 02:15:46 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: acpi_wakecode.S,v 1.7 2008/05/25 17:20:29 joerg Exp $  */
+/*     $NetBSD: acpi_wakecode.S,v 1.8 2009/08/24 02:15:46 jmcneill Exp $       */
 
 /*-
  * Copyright (c) 2007 Joerg Sonnenberger <joerg%netbsd.org@localhost>
@@ -125,6 +125,20 @@
        outb    %al,$0x61
 1:
 
+       /* If we need to restore a VESA VBE mode, do it now */
+       cmpb    $0,WAKEUP_vesa_modenum
+       je      1f
+       movw    WAKEUP_vesa_modenum,%bx
+       orw     $0x4000,%bx
+       movw    $0x4f02,%ax
+       int     $0x10
+
+       /* paranoia */
+       movw    %cs,%ax
+       movw    %ax,%ds
+       movw    %ax,%ss
+1:
+
        /* Load temporary 32bit GDT */
        data32 addr32 lgdt      tmp_gdt
 
diff -r 88b5c71028db -r df51a16b575d sys/arch/i386/acpi/acpi_wakecode.S
--- a/sys/arch/i386/acpi/acpi_wakecode.S        Mon Aug 24 02:10:41 2009 +0000
+++ b/sys/arch/i386/acpi/acpi_wakecode.S        Mon Aug 24 02:15:46 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: acpi_wakecode.S,v 1.12 2008/04/28 20:23:23 martin Exp $        */
+/*     $NetBSD: acpi_wakecode.S,v 1.13 2009/08/24 02:15:46 jmcneill Exp $      */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -121,6 +121,20 @@
        outb    %al,$0x61
 1:
 
+       /* If we need to restore a VESA VBE mode, do it now */
+       cmpb    $0,WAKEUP_vesa_modenum
+       je      1f
+       movw    WAKEUP_vesa_modenum,%bx
+       orw     $0x4000,%bx
+       movw    $0x4f02,%ax
+       int     $0x10
+
+       /* paranoia */
+       movw    %cs,%ax
+       movw    %ax,%ds
+       movw    %ax,%ss
+1:
+
        /* Load GDT while non-paging */
        lgdt    tmp_gdt
 
@@ -199,5 +213,7 @@
 
        .global WAKEUP_vbios_reset
 WAKEUP_vbios_reset:    .byte 0
+       .global WAKEUP_vesa_modenum
+WAKEUP_vesa_modenum:   .word 0
        .global WAKEUP_beep_on_reset
 WAKEUP_beep_on_reset:  .byte 0
diff -r 88b5c71028db -r df51a16b575d sys/arch/i386/stand/lib/vbe.c
--- a/sys/arch/i386/stand/lib/vbe.c     Mon Aug 24 02:10:41 2009 +0000
+++ b/sys/arch/i386/stand/lib/vbe.c     Mon Aug 24 02:15:46 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vbe.c,v 1.2 2009/02/17 23:17:39 jmcneill Exp $ */
+/* $NetBSD: vbe.c,v 1.3 2009/08/24 02:15:46 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2009 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -166,6 +166,7 @@
        fb.gpos = mi.GreenFieldPosition;
        fb.bnum = mi.BlueMaskSize;
        fb.bpos = mi.BlueFieldPosition;
+       fb.vbemode = modenum;
 
        framebuffer_configure(&fb);
 
diff -r 88b5c71028db -r df51a16b575d sys/arch/x86/acpi/acpi_wakeup.c
--- a/sys/arch/x86/acpi/acpi_wakeup.c   Mon Aug 24 02:10:41 2009 +0000
+++ b/sys/arch/x86/acpi/acpi_wakeup.c   Mon Aug 24 02:15:46 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: acpi_wakeup.c,v 1.15 2009/08/18 16:41:03 jmcneill Exp $        */
+/*     $NetBSD: acpi_wakeup.c,v 1.16 2009/08/24 02:15:46 jmcneill Exp $        */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_wakeup.c,v 1.15 2009/08/18 16:41:03 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_wakeup.c,v 1.16 2009/08/24 02:15:46 jmcneill Exp $");
 
 /*-
  * Copyright (c) 2001 Takanori Watanabe <takawata%jp.freebsd.org@localhost>
@@ -111,6 +111,7 @@
 
 static int acpi_md_node = CTL_EOL;
 int acpi_md_vbios_reset = 1; /* Referenced by dev/pci/vga_pci.c */
+int acpi_md_vesa_modenum = 0; /* Referenced by arch/x86/x86/genfb_machdep.c */
 static int acpi_md_beep_on_reset = 0;
 
 static int     sysctl_md_acpi_vbios_reset(SYSCTLFN_ARGS);
@@ -150,9 +151,11 @@
        memcpy( (void *)acpi_wakeup_vaddr, wakecode, sizeof(wakecode));
 
        if (CPU_IS_PRIMARY(ci)) {
+               WAKECODE_FIXUP(WAKEUP_vesa_modenum, uint16_t, acpi_md_vesa_modenum);
                WAKECODE_FIXUP(WAKEUP_vbios_reset, uint8_t, acpi_md_vbios_reset);
                WAKECODE_FIXUP(WAKEUP_beep_on_reset, uint8_t, acpi_md_beep_on_reset);
        } else {
+               WAKECODE_FIXUP(WAKEUP_vesa_modenum, uint16_t, 0);
                WAKECODE_FIXUP(WAKEUP_vbios_reset, uint8_t, 0);
                WAKECODE_FIXUP(WAKEUP_beep_on_reset, uint8_t, 0);
        }
diff -r 88b5c71028db -r df51a16b575d sys/arch/x86/include/bootinfo.h
--- a/sys/arch/x86/include/bootinfo.h   Mon Aug 24 02:10:41 2009 +0000
+++ b/sys/arch/x86/include/bootinfo.h   Mon Aug 24 02:15:46 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bootinfo.h,v 1.15 2009/02/16 22:29:33 jmcneill Exp $   */
+/*     $NetBSD: bootinfo.h,v 1.16 2009/08/24 02:15:46 jmcneill Exp $   */
 
 /*
  * Copyright (c) 1997
@@ -195,7 +195,8 @@
        uint8_t rpos;
        uint8_t gpos;
        uint8_t bpos;
-       uint8_t reserved[16];
+       uint16_t vbemode;
+       uint8_t reserved[14];
 };
 
 #endif /* _LOCORE */
diff -r 88b5c71028db -r df51a16b575d sys/arch/x86/x86/genfb_machdep.c
--- a/sys/arch/x86/x86/genfb_machdep.c  Mon Aug 24 02:10:41 2009 +0000
+++ b/sys/arch/x86/x86/genfb_machdep.c  Mon Aug 24 02:15:46 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: genfb_machdep.c,v 1.2 2009/02/17 02:21:13 jmcneill Exp $ */
+/* $NetBSD: genfb_machdep.c,v 1.3 2009/08/24 02:15:46 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2009 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: genfb_machdep.c,v 1.2 2009/02/17 02:21:13 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfb_machdep.c,v 1.3 2009/08/24 02:15:46 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -52,10 +52,15 @@
 
 #include "wsdisplay.h"
 #include "genfb.h"
+#include "acpica.h"
 
 #if NWSDISPLAY > 0 && NGENFB > 0
 struct vcons_screen x86_genfb_console_screen;
 
+#if NACPICA > 0
+extern int acpi_md_vesa_modenum;
+#endif
+
 static struct wsscreen_descr x86_genfb_stdscreen = {
        "std",
        0, 0,
@@ -104,6 +109,10 @@
                return 0;
        }
 
+#if NACPICA > 0
+       acpi_md_vesa_modenum = fbinfo->vbemode;
+#endif
+
        wsfont_init();
 
        ri->ri_width = fbinfo->width;



Home | Main Index | Thread Index | Old Index