]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
Use ACPI shutdown intests as traditional port was removed.
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Thu, 11 Apr 2013 19:09:43 +0000 (21:09 +0200)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Thu, 11 Apr 2013 19:09:43 +0000 (21:09 +0200)
ChangeLog
grub-core/tests/boot/kbsd.init-i386.S
grub-core/tests/boot/kbsd.init-x86_64.S
grub-core/tests/boot/kernel-8086.S
grub-core/tests/boot/kernel-i386.S
grub-core/tests/boot/kfreebsd.init-i386.S
grub-core/tests/boot/kfreebsd.init-x86_64.S
grub-core/tests/boot/linux.init-i386.S
grub-core/tests/boot/linux.init-x86_64.S
grub-core/tests/boot/qemu-shutdown-x86.S [new file with mode: 0644]

index bb6d97bf465fac38caf373d6931e7a73465e9aed..614748afce972b35219633246e1073fe9f6f5a10 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2013-04-11  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       Use ACPI shutdown intests as traditional port was removed.
+
 2013-04-11  Andrey Borzenkov <arvidjaar@gmail.com>
 
        * util/grub.d/30_os-prober.in: Add onstr to entries for visual
index 7011c79ffb7c429141d0122242b170676e40887a..72ddb7c164e24c54ee87c70f7aa392763798b0c0 100644 (file)
@@ -37,8 +37,6 @@
 #define RESET_HALT 0x8
 #define RESET_POWEROFF 0x800
 
-#define SHUTDOWN_PORT 0x8900
-
        .section ".init", "ax"
        .global start,_start
 start:
@@ -72,23 +70,7 @@ _start:
        int $SYSCALL_INT
        addl $12, %esp
 
-       movw $SHUTDOWN_PORT, %dx
-       movb $'S', %al
-       outb %al, %dx
-       movb $'h', %al
-       outb %al, %dx
-       movb $'u', %al
-       outb %al, %dx
-       movb $'t', %al
-       outb %al, %dx
-       movb $'d', %al
-       outb %al, %dx
-       movb $'o', %al
-       outb %al, %dx
-       movb $'w', %al
-       outb %al, %dx
-       movb $'n', %al
-       outb %al, %dx
+#include "qemu-shutdown-x86.S"
 
        /* shutdown.  */
        movl $SYSCALL_RESET, %eax
index 81f810e2cf0a671a5636d024205fccd4aa5afc49..7486bc31223a6b2b99a4fc7399a82ab2ecb5acca 100644 (file)
@@ -35,7 +35,6 @@
 #define RESET_NOSYNC 0x4
 #define RESET_HALT 0x8
 #define RESET_POWEROFF 0x800
-#define SHUTDOWN_PORT 0x8900
 
        .section ".init", "ax"
        .global start,_start
@@ -61,23 +60,7 @@ _start:
        leaq iopl_arg, %rsi
        syscall
 
-       movw $SHUTDOWN_PORT, %dx
-       movb $'S', %al
-       outb %al, %dx
-       movb $'h', %al
-       outb %al, %dx
-       movb $'u', %al
-       outb %al, %dx
-       movb $'t', %al
-       outb %al, %dx
-       movb $'d', %al
-       outb %al, %dx
-       movb $'o', %al
-       outb %al, %dx
-       movb $'w', %al
-       outb %al, %dx
-       movb $'n', %al
-       outb %al, %dx
+#include "qemu-shutdown-x86.S"
 
        /* shutdown.  */
        movq $SYSCALL_RESET, %rax
index 20040dabc617b03fd95a059bd82ba0f9f591850d..510897c883f0be7bb438d5de137dd2e3840f92d9 100644 (file)
@@ -1,6 +1,4 @@
 
-#define SHUTDOWN_PORT 0x8900
-
        .text
        .globl _start
 _start:
@@ -8,18 +6,6 @@ base:
        .code16
        jmp cont
 
-portmsg:
-       xorw %ax, %ax
-1:     
-       movb 0(%si), %al
-       test %ax, %ax
-       jz 1f
-       outb %al, %dx
-       incw %si
-       jmp 1b
-1:
-       ret
-
 serialmsg:     
 1:     
        movb 0(%si), %bl
@@ -50,17 +36,12 @@ cont:
        movw %ax, %ds
        lea message, %si
        call serialmsg
-       lea shutdown, %si
-       movw $SHUTDOWN_PORT, %dx
-       call portmsg
+#include "qemu-shutdown-x86.S"
 
 1:
        hlt
        jmp 1b
 
-shutdown:
-       .ascii "Shutdown"
-       .byte 0
 message:
        .ascii "Boot Test Passed Successfully\n" SUCCESSFUL_BOOT_STRING "\n"
        .byte 0
index 904b0d4c7283cdc709af36b20a60e7166c5d1f08..2154d3b2df1cf6766f6f4f8ea07dc7356e1f97e3 100644 (file)
@@ -5,8 +5,6 @@
 #include <multiboot.h>
 #endif
 
-#define SHUTDOWN_PORT 0x8900
-
        .text
        /* Align 32 bits boundary.  */
        .align  8
@@ -38,17 +36,6 @@ multiboot_header:
 #endif
        
        .global start
-portmsg:
-       xorl %eax, %eax
-1:     
-       movb 0(%esi), %al
-       test %eax, %eax
-       jz 1f
-       outb %al, %dx
-       incl %esi
-       jmp 1b
-1:
-       ret
 
 serialmsg:     
 1:     
@@ -73,17 +60,13 @@ serialmsg:
 _start:
        lea message, %esi
        call serialmsg
-       lea shutdown, %esi
-       movw $SHUTDOWN_PORT, %dx
-       call portmsg
+
+#include "qemu-shutdown-x86.S"
 
 1:
        hlt
        jmp 1b
 
-shutdown:
-       .ascii "Shutdown"
-       .byte 0
 message:
        .ascii "Boot Test Passed Successfully\n" SUCCESSFUL_BOOT_STRING "\n"
        .byte 0
index 12c94a036e1bf7b975cf387032e6adafa584f428..a4481520a2814fcebcacd90698642aef7f68680e 100644 (file)
 #define SYSCALL_FSYNC 95
 #define SYSCALL_ARCH 165
 #define SYSCALL_EXIT 1
-#define SYSCALL_ARCH_IOPL      4
+#define SYSCALL_ARCH_IOPERM    4
 #define SYSCALL_INT 0x80
 
 #define RESET_NOSYNC 0x4
 #define RESET_HALT 0x8
 #define RESET_POWEROFF 0x4000
-#define SHUTDOWN_PORT 0x8900
 
        .section ".init", "ax"
        .global start,_start
@@ -64,31 +63,23 @@ _start:
        int $SYSCALL_INT
        addl $8, %esp
 
-       /* IOPL.  */
+       /* IOPERM.  */
        movl $SYSCALL_ARCH, %eax
-       pushl $iopl_arg
-       pushl $SYSCALL_ARCH_IOPL
+       pushl $iopl_arg1
+       pushl $SYSCALL_ARCH_IOPERM
        pushl $0
        int $SYSCALL_INT
        addl $12, %esp
-       
-       movw $SHUTDOWN_PORT, %dx
-       movb $'S', %al
-       outb %al, %dx
-       movb $'h', %al
-       outb %al, %dx
-       movb $'u', %al
-       outb %al, %dx
-       movb $'t', %al
-       outb %al, %dx
-       movb $'d', %al
-       outb %al, %dx
-       movb $'o', %al
-       outb %al, %dx
-       movb $'w', %al
-       outb %al, %dx
-       movb $'n', %al
-       outb %al, %dx
+
+       /* IOPERM.  */
+       movl $SYSCALL_ARCH, %eax
+       pushl $iopl_arg2
+       pushl $SYSCALL_ARCH_IOPERM
+       pushl $0
+       int $SYSCALL_INT
+       addl $12, %esp
+
+#include "qemu-shutdown-x86.S"
        
        /* shutdown.  */
        movl $SYSCALL_RESET, %eax
@@ -108,7 +99,11 @@ device:
 message:
        .ascii "Boot Test Passed Successfully\n" SUCCESSFUL_BOOT_STRING "\n"
 messageend:
-iopl_arg:
-       .long SHUTDOWN_PORT
+ioperm_arg1:
+       .long 0xcf8
+       .long 8
        .long 1
+ioperm_arg2:
+       .long 0x1000
+       .long 8
        .long 1
index 0a9ff511efe1b9aed94c95c48e810ffff17b3cd5..de7bab6cea62641580e8209b7bfcf7a3d014c0ea 100644 (file)
 #define SYSCALL_WRITE 4
 #define SYSCALL_RESET 55
 #define SYSCALL_EXIT 1
-#define SYSCALL_ARCH_IOPL      4
+#define SYSCALL_ARCH_IOPERM    4
 #define SYSCALL_FSYNC 95
 
 #define RESET_NOSYNC 0x4
 #define RESET_HALT 0x8
 #define RESET_POWEROFF 0x4000
-#define SHUTDOWN_PORT 0x8900
 
        .section ".init", "ax"
        .global start,_start
@@ -53,29 +52,18 @@ _start:
        movq $SYSCALL_FSYNC, %rax
        syscall
 
-       /* IOPL.  */
+       /* IOPERM.  */
        movq $SYSCALL_ARCH, %rax
-       movq $SYSCALL_ARCH_IOPL, %rdi
-       leaq iopl_arg, %rsi
+       movq $SYSCALL_ARCH_IOPERM, %rdi
+       leaq ioperm_arg1, %rsi
        syscall
 
-       movw $SHUTDOWN_PORT, %dx
-       movb $'S', %al
-       outb %al, %dx
-       movb $'h', %al
-       outb %al, %dx
-       movb $'u', %al
-       outb %al, %dx
-       movb $'t', %al
-       outb %al, %dx
-       movb $'d', %al
-       outb %al, %dx
-       movb $'o', %al
-       outb %al, %dx
-       movb $'w', %al
-       outb %al, %dx
-       movb $'n', %al
-       outb %al, %dx
+       movq $SYSCALL_ARCH, %rax
+       movq $SYSCALL_ARCH_IOPERM, %rdi
+       leaq ioperm_arg2, %rsi
+       syscall
+
+#include "qemu-shutdown-x86.S"
        
        /* shutdown.  */
        movq $SYSCALL_RESET, %rax
@@ -92,7 +80,11 @@ device:
 message:
        .ascii "Boot Test Passed Successfully\n" SUCCESSFUL_BOOT_STRING "\n"
 messageend:
-iopl_arg:
-       .long SHUTDOWN_PORT
+ioperm_arg1:
+       .long 0xcf8
+       .long 8
        .long 1
+ioperm_arg2:
+       .long 0x1000
+       .long 8
        .long 1
index 5b0088e00758350c76e1e23f7a1c3b0eaed04b04..c0983ac0acc75e58eb36d805d1d3ad719901319e 100644 (file)
@@ -27,8 +27,6 @@
 #define SHUTDOWN_MAGIC2 0x28121969
 #define SHUTDOWN_MAGIC3 0x4321fedc
 
-#define SHUTDOWN_PORT 0x8900
-
        .text
        .global start, _start
 _start:
@@ -44,23 +42,7 @@ start:
        movl $3, %ebx
        int $SYSCALL_INT
 
-       movw $SHUTDOWN_PORT, %dx
-       movb $'S', %al
-       outb %al, %dx
-       movb $'h', %al
-       outb %al, %dx
-       movb $'u', %al
-       outb %al, %dx
-       movb $'t', %al
-       outb %al, %dx
-       movb $'d', %al
-       outb %al, %dx
-       movb $'o', %al
-       outb %al, %dx
-       movb $'w', %al
-       outb %al, %dx
-       movb $'n', %al
-       outb %al, %dx
+#include "qemu-shutdown-x86.S"
        
        /* shutdown.  */
        movl $SYSCALL_RESET, %eax
index fc32dfd912d9b528b2fabf38a8e235701fec5c9f..90bdcc356a6bbc8eb4dd8a1e1abdb579443ca718 100644 (file)
@@ -26,8 +26,6 @@
 #define SHUTDOWN_MAGIC2 0x28121969
 #define SHUTDOWN_MAGIC3 0x4321fedc
 
-#define SHUTDOWN_PORT 0x8900
-
        .text
        .global start, _start
 _start:
@@ -43,23 +41,7 @@ start:
        movq $3, %rdi
        syscall
 
-       movw $SHUTDOWN_PORT, %dx
-       movb $'S', %al
-       outb %al, %dx
-       movb $'h', %al
-       outb %al, %dx
-       movb $'u', %al
-       outb %al, %dx
-       movb $'t', %al
-       outb %al, %dx
-       movb $'d', %al
-       outb %al, %dx
-       movb $'o', %al
-       outb %al, %dx
-       movb $'w', %al
-       outb %al, %dx
-       movb $'n', %al
-       outb %al, %dx
+#include "qemu-shutdown-x86.S"
        
        /* shutdown.  */
        movq $SYSCALL_RESET, %rax
diff --git a/grub-core/tests/boot/qemu-shutdown-x86.S b/grub-core/tests/boot/qemu-shutdown-x86.S
new file mode 100644 (file)
index 0000000..8f794fc
--- /dev/null
@@ -0,0 +1,9 @@
+       movl $0x80000b40, %eax
+       movw $0xcf8, %dx
+       outl  %eax, %dx
+       movl $0x1001, %eax
+       movw $0xcfc, %dx
+       outl  %eax, %dx
+       movw $0x2000, %ax
+       movw $0x1004, %dx       
+       outw  %ax, %dx