The patch titled

     Generic acpi vgapost

has been added to the -mm tree.  Its filename is

     generic-acpi-vgapost.patch

Patches currently in -mm which might be from [EMAIL PROTECTED] are

generic-acpi-vgapost.patch
radeonfb-s3-acpi-suspend-fix.patch
radeonfb-s3-acpi-suspend-fix-fix.patch
documentation-update-for-radeonfb.patch



From: Michael Marineau <[EMAIL PROTECTED]>

Generic function to post the video bios.

Based directly on the original patch by Ole Rohne.

Signed-off-by: Michael Marineau <[EMAIL PROTECTED]>
Acked-by: Pavel Machek <[EMAIL PROTECTED]>
Cc: Benjamin Herrenschmidt <[EMAIL PROTECTED]>
Cc: "Brown, Len" <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
---

 arch/i386/kernel/acpi/sleep.c  |   29 +++++++++++++++
 arch/i386/kernel/acpi/wakeup.S |   79 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 108 insertions(+)

diff -puN arch/i386/kernel/acpi/sleep.c~generic-acpi-vgapost 
arch/i386/kernel/acpi/sleep.c
--- 25/arch/i386/kernel/acpi/sleep.c~generic-acpi-vgapost       Mon Aug 29 
16:42:47 2005
+++ 25-akpm/arch/i386/kernel/acpi/sleep.c       Mon Aug 29 16:42:47 2005
@@ -5,6 +5,7 @@
  *  Copyright (C) 2001-2003 Pavel Machek <[EMAIL PROTECTED]>
  */
 
+#include <linux/module.h>
 #include <linux/acpi.h>
 #include <linux/bootmem.h>
 #include <linux/dmi.h>
@@ -58,6 +59,34 @@ void acpi_restore_state_mem(void)
        zap_low_mappings();
 }
 
+/*
+ * acpi_vgapost
+ */
+
+extern void do_vgapost_lowlevel (unsigned long);
+
+void acpi_vgapost (unsigned long slot)
+{
+       unsigned long flags, saved_video_flags = acpi_video_flags;
+
+       acpi_video_flags = (slot & 0xffff) << 16 | 1;
+
+       /* Map low memory and copy information */
+       init_low_mapping(swapper_pg_dir, USER_PTRS_PER_PGD);
+       memcpy((void *) acpi_wakeup_address, &wakeup_start, &wakeup_end - 
&wakeup_start);
+       acpi_copy_wakeup_routine(acpi_wakeup_address);
+
+       /* Tunnel thru real mode */
+       local_irq_save(flags);
+       do_vgapost_lowlevel(acpi_wakeup_address);
+       local_irq_restore(flags);
+
+       /* Restore mapping etc */
+       zap_low_mappings();
+       acpi_video_flags = saved_video_flags;
+}
+EXPORT_SYMBOL (acpi_vgapost);
+
 /**
  * acpi_reserve_bootmem - do _very_ early ACPI initialisation
  *
diff -puN arch/i386/kernel/acpi/wakeup.S~generic-acpi-vgapost 
arch/i386/kernel/acpi/wakeup.S
--- 25/arch/i386/kernel/acpi/wakeup.S~generic-acpi-vgapost      Mon Aug 29 
16:42:47 2005
+++ 25-akpm/arch/i386/kernel/acpi/wakeup.S      Mon Aug 29 16:42:47 2005
@@ -171,6 +171,32 @@ check_vesa:
 
 _setbad: jmp setbad
 
+#
+#      Real mode switch - verbatim from reboot.c
+#
+go_real:
+       movl    %cr0, %eax
+       andl    $0x00000011, %eax
+       orl     $0x60000000, %eax
+       movl    %eax, %cr0
+       movl    %eax, %cr3
+       movl    %cr0, %ebx
+       andl    $0x60000000, %ebx
+       jz      1f
+       wbinvd
+1:     andb    $0x10, %al
+       movl    %eax, %cr0
+go_real_jmp:           .byte   0xea
+go_real_jmp_off:       .word   0x0000
+go_real_jmp_seg:       .word   0x0000
+#
+#      Real mode descriptor table
+#
+               .align  8
+go_real_desc:  .quad   0x0000000000000000
+go_real_cseg:  .quad   0x00009a000000ffff
+go_real_dseg:  .quad   0x000092000000ffff
+
        .code32
        ALIGN
 
@@ -310,6 +336,59 @@ ENTRY(do_suspend_lowlevel_s4bios)
        call acpi_enter_sleep_state_s4bios
        ret
 
+ENTRY(do_vgapost_lowlevel)
+       # Convert target offset to physical address
+       movl    %eax, %ecx
+       subl    $__PAGE_OFFSET, %ecx
+       # Fixup GDT pointer
+       movl    %ecx, %edx
+       addl    $go_real_desc - wakeup_start, %edx
+       movl    %edx, go_real_gdt + 2
+       # Fixup 16-bit CS descriptor
+       movl    %ecx, %edx
+       movw    %dx, go_real_cseg - wakeup_start + 2 (%eax)
+       shrl    $16, %edx
+       movb    %dl, go_real_cseg - wakeup_start + 4 (%eax)
+       movb    %dh, go_real_cseg - wakeup_start + 7 (%eax)
+       # Fixup 16-bit jump
+       movl    %ecx, %edx
+       shrl    $4, %edx
+       movw    %dx, go_real_jmp_seg - wakeup_start (%eax)
+       # Save state and registers
+       call    save_processor_state
+       call    save_registers
+       # Reload page table with low mapping
+       movl    $swapper_pg_dir-__PAGE_OFFSET, %eax
+       movl    %eax, %cr3
+       # Load IDTR and GDTR for real mode
+       lidt    go_real_idt
+       lgdt    go_real_gdt
+       # Load DS & al
+       movl    $0x0010, %eax
+       movl    %eax, %ss
+       movl    %eax, %ds
+       movl    %eax, %es
+       movl    %eax, %fs
+       movl    %eax, %gs
+       # Load CS
+       call    $0x0008, $(go_real - wakeup_start)
+       # Phony return code
+       call    restore_registers
+       call    restore_processor_state
+       ret
+
+       .align  4
+       .word   0
+go_real_idt:
+       .word   0x3ff
+       .long   0
+
+       .align  4
+       .word   0
+go_real_gdt:
+       .word   3*8-1
+       .long   0
+
 ALIGN
 # saved registers
 saved_gdt:     .long   0,0
_
-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to