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.
This commit is contained in:
jmcneill 2009-08-24 02:15:46 +00:00
parent 5198b6e109
commit b585cf85b2
6 changed files with 53 additions and 9 deletions

View File

@ -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>
@ -125,6 +125,20 @@ wakeup_16:
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

View File

@ -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 @@ wakeup_16:
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 @@ WAKEUP_restorecpu: .long 0
.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

View File

@ -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>
@ -166,6 +166,7 @@ vbe_set_mode(int modenum)
fb.gpos = mi.GreenFieldPosition;
fb.bnum = mi.BlueMaskSize;
fb.bpos = mi.BlueFieldPosition;
fb.vbemode = modenum;
framebuffer_configure(&fb);

View File

@ -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>
@ -111,6 +111,7 @@ static vaddr_t acpi_wakeup_vaddr;
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 @@ acpi_md_sleep_patch(struct cpu_info *ci)
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);
}

View File

@ -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 @@ struct btinfo_framebuffer {
uint8_t rpos;
uint8_t gpos;
uint8_t bpos;
uint8_t reserved[16];
uint16_t vbemode;
uint8_t reserved[14];
};
#endif /* _LOCORE */

View File

@ -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>
@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: genfb_machdep.c,v 1.2 2009/02/17 02:21:13 jmcneill E
#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 @@ x86_genfb_cnattach(void)
return 0;
}
#if NACPICA > 0
acpi_md_vesa_modenum = fbinfo->vbemode;
#endif
wsfont_init();
ri->ri_width = fbinfo->width;