Module Name: src
Committed By: jmcneill
Date: Mon Aug 24 02:15:46 UTC 2009
Modified Files:
src/sys/arch/amd64/acpi: acpi_wakecode.S
src/sys/arch/i386/acpi: acpi_wakecode.S
src/sys/arch/i386/stand/lib: vbe.c
src/sys/arch/x86/acpi: acpi_wakeup.c
src/sys/arch/x86/include: bootinfo.h
src/sys/arch/x86/x86: genfb_machdep.c
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/amd64/acpi/acpi_wakecode.S
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/i386/acpi/acpi_wakecode.S
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/i386/stand/lib/vbe.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/x86/acpi/acpi_wakeup.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/x86/include/bootinfo.h
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/x86/x86/genfb_machdep.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/amd64/acpi/acpi_wakecode.S
diff -u src/sys/arch/amd64/acpi/acpi_wakecode.S:1.7 src/sys/arch/amd64/acpi/acpi_wakecode.S:1.8
--- src/sys/arch/amd64/acpi/acpi_wakecode.S:1.7 Sun May 25 17:20:29 2008
+++ src/sys/arch/amd64/acpi/acpi_wakecode.S Mon Aug 24 02:15:46 2009
@@ -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 <[email protected]>
@@ -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
Index: src/sys/arch/i386/acpi/acpi_wakecode.S
diff -u src/sys/arch/i386/acpi/acpi_wakecode.S:1.12 src/sys/arch/i386/acpi/acpi_wakecode.S:1.13
--- src/sys/arch/i386/acpi/acpi_wakecode.S:1.12 Mon Apr 28 20:23:23 2008
+++ src/sys/arch/i386/acpi/acpi_wakecode.S Mon Aug 24 02:15:46 2009
@@ -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
Index: src/sys/arch/i386/stand/lib/vbe.c
diff -u src/sys/arch/i386/stand/lib/vbe.c:1.2 src/sys/arch/i386/stand/lib/vbe.c:1.3
--- src/sys/arch/i386/stand/lib/vbe.c:1.2 Tue Feb 17 23:17:39 2009
+++ src/sys/arch/i386/stand/lib/vbe.c Mon Aug 24 02:15:46 2009
@@ -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 <[email protected]>
@@ -166,6 +166,7 @@
fb.gpos = mi.GreenFieldPosition;
fb.bnum = mi.BlueMaskSize;
fb.bpos = mi.BlueFieldPosition;
+ fb.vbemode = modenum;
framebuffer_configure(&fb);
Index: src/sys/arch/x86/acpi/acpi_wakeup.c
diff -u src/sys/arch/x86/acpi/acpi_wakeup.c:1.15 src/sys/arch/x86/acpi/acpi_wakeup.c:1.16
--- src/sys/arch/x86/acpi/acpi_wakeup.c:1.15 Tue Aug 18 16:41:03 2009
+++ src/sys/arch/x86/acpi/acpi_wakeup.c Mon Aug 24 02:15:46 2009
@@ -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 <[email protected]>
@@ -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);
}
Index: src/sys/arch/x86/include/bootinfo.h
diff -u src/sys/arch/x86/include/bootinfo.h:1.15 src/sys/arch/x86/include/bootinfo.h:1.16
--- src/sys/arch/x86/include/bootinfo.h:1.15 Mon Feb 16 22:29:33 2009
+++ src/sys/arch/x86/include/bootinfo.h Mon Aug 24 02:15:46 2009
@@ -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 */
Index: src/sys/arch/x86/x86/genfb_machdep.c
diff -u src/sys/arch/x86/x86/genfb_machdep.c:1.2 src/sys/arch/x86/x86/genfb_machdep.c:1.3
--- src/sys/arch/x86/x86/genfb_machdep.c:1.2 Tue Feb 17 02:21:13 2009
+++ src/sys/arch/x86/x86/genfb_machdep.c Mon Aug 24 02:15:46 2009
@@ -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 <[email protected]>
@@ -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;