dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

Blame SOURCES/0279-Use-ACPI-shutdown-intests-as-traditional-port-was-re.patch

f96e0b
From 7789de5b693525b7df0fca50d68000c26bdcfe8c Mon Sep 17 00:00:00 2001
f96e0b
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
f96e0b
Date: Thu, 11 Apr 2013 21:09:43 +0200
f96e0b
Subject: [PATCH 279/482] 	Use ACPI shutdown intests as traditional port
f96e0b
 was removed.
f96e0b
f96e0b
---
f96e0b
 ChangeLog                                   |  4 +++
f96e0b
 grub-core/tests/boot/kbsd.init-i386.S       | 20 +------------
f96e0b
 grub-core/tests/boot/kbsd.init-x86_64.S     | 19 +-----------
f96e0b
 grub-core/tests/boot/kernel-8086.S          | 21 +-------------
f96e0b
 grub-core/tests/boot/kernel-i386.S          | 21 ++------------
f96e0b
 grub-core/tests/boot/kfreebsd.init-i386.S   | 45 +++++++++++++----------------
f96e0b
 grub-core/tests/boot/kfreebsd.init-x86_64.S | 40 ++++++++++---------------
f96e0b
 grub-core/tests/boot/linux.init-i386.S      | 20 +------------
f96e0b
 grub-core/tests/boot/linux.init-x86_64.S    | 20 +------------
f96e0b
 grub-core/tests/boot/qemu-shutdown-x86.S    |  9 ++++++
f96e0b
 10 files changed, 56 insertions(+), 163 deletions(-)
f96e0b
 create mode 100644 grub-core/tests/boot/qemu-shutdown-x86.S
f96e0b
f96e0b
diff --git a/ChangeLog b/ChangeLog
f96e0b
index bb6d97b..614748a 100644
f96e0b
--- a/ChangeLog
f96e0b
+++ b/ChangeLog
f96e0b
@@ -1,3 +1,7 @@
f96e0b
+2013-04-11  Vladimir Serbinenko  <phcoder@gmail.com>
f96e0b
+
f96e0b
+	Use ACPI shutdown intests as traditional port was removed.
f96e0b
+
f96e0b
 2013-04-11  Andrey Borzenkov <arvidjaar@gmail.com>
f96e0b
 
f96e0b
 	* util/grub.d/30_os-prober.in: Add onstr to entries for visual
f96e0b
diff --git a/grub-core/tests/boot/kbsd.init-i386.S b/grub-core/tests/boot/kbsd.init-i386.S
f96e0b
index 7011c79..72ddb7c 100644
f96e0b
--- a/grub-core/tests/boot/kbsd.init-i386.S
f96e0b
+++ b/grub-core/tests/boot/kbsd.init-i386.S
f96e0b
@@ -37,8 +37,6 @@
f96e0b
 #define RESET_HALT 0x8
f96e0b
 #define RESET_POWEROFF 0x800
f96e0b
 
f96e0b
-#define SHUTDOWN_PORT 0x8900
f96e0b
-
f96e0b
 	.section ".init", "ax"
f96e0b
 	.global start,_start
f96e0b
 start:
f96e0b
@@ -72,23 +70,7 @@ _start:
f96e0b
 	int $SYSCALL_INT
f96e0b
 	addl $12, %esp
f96e0b
 
f96e0b
-	movw $SHUTDOWN_PORT, %dx
f96e0b
-	movb $'S', %al
f96e0b
-	outb %al, %dx
f96e0b
-	movb $'h', %al
f96e0b
-	outb %al, %dx
f96e0b
-	movb $'u', %al
f96e0b
-	outb %al, %dx
f96e0b
-	movb $'t', %al
f96e0b
-	outb %al, %dx
f96e0b
-	movb $'d', %al
f96e0b
-	outb %al, %dx
f96e0b
-	movb $'o', %al
f96e0b
-	outb %al, %dx
f96e0b
-	movb $'w', %al
f96e0b
-	outb %al, %dx
f96e0b
-	movb $'n', %al
f96e0b
-	outb %al, %dx
f96e0b
+#include "qemu-shutdown-x86.S"
f96e0b
 
f96e0b
 	/* shutdown.  */
f96e0b
 	movl $SYSCALL_RESET, %eax
f96e0b
diff --git a/grub-core/tests/boot/kbsd.init-x86_64.S b/grub-core/tests/boot/kbsd.init-x86_64.S
f96e0b
index 81f810e..7486bc3 100644
f96e0b
--- a/grub-core/tests/boot/kbsd.init-x86_64.S
f96e0b
+++ b/grub-core/tests/boot/kbsd.init-x86_64.S
f96e0b
@@ -35,7 +35,6 @@
f96e0b
 #define RESET_NOSYNC 0x4
f96e0b
 #define RESET_HALT 0x8
f96e0b
 #define RESET_POWEROFF 0x800
f96e0b
-#define SHUTDOWN_PORT 0x8900
f96e0b
 
f96e0b
 	.section ".init", "ax"
f96e0b
 	.global start,_start
f96e0b
@@ -61,23 +60,7 @@ _start:
f96e0b
 	leaq iopl_arg, %rsi
f96e0b
 	syscall
f96e0b
 
f96e0b
-	movw $SHUTDOWN_PORT, %dx
f96e0b
-	movb $'S', %al
f96e0b
-	outb %al, %dx
f96e0b
-	movb $'h', %al
f96e0b
-	outb %al, %dx
f96e0b
-	movb $'u', %al
f96e0b
-	outb %al, %dx
f96e0b
-	movb $'t', %al
f96e0b
-	outb %al, %dx
f96e0b
-	movb $'d', %al
f96e0b
-	outb %al, %dx
f96e0b
-	movb $'o', %al
f96e0b
-	outb %al, %dx
f96e0b
-	movb $'w', %al
f96e0b
-	outb %al, %dx
f96e0b
-	movb $'n', %al
f96e0b
-	outb %al, %dx
f96e0b
+#include "qemu-shutdown-x86.S"
f96e0b
 
f96e0b
 	/* shutdown.  */
f96e0b
 	movq $SYSCALL_RESET, %rax
f96e0b
diff --git a/grub-core/tests/boot/kernel-8086.S b/grub-core/tests/boot/kernel-8086.S
f96e0b
index 20040da..510897c 100644
f96e0b
--- a/grub-core/tests/boot/kernel-8086.S
f96e0b
+++ b/grub-core/tests/boot/kernel-8086.S
f96e0b
@@ -1,6 +1,4 @@
f96e0b
 
f96e0b
-#define SHUTDOWN_PORT 0x8900
f96e0b
-
f96e0b
 	.text
f96e0b
 	.globl _start
f96e0b
 _start:
f96e0b
@@ -8,18 +6,6 @@ base:
f96e0b
 	.code16
f96e0b
 	jmp cont
f96e0b
 
f96e0b
-portmsg:
f96e0b
-	xorw %ax, %ax
f96e0b
-1:	
f96e0b
-	movb 0(%si), %al
f96e0b
-	test %ax, %ax
f96e0b
-	jz 1f
f96e0b
-	outb %al, %dx
f96e0b
-	incw %si
f96e0b
-	jmp 1b
f96e0b
-1:
f96e0b
-	ret
f96e0b
-
f96e0b
 serialmsg:	
f96e0b
 1:	
f96e0b
 	movb 0(%si), %bl
f96e0b
@@ -50,17 +36,12 @@ cont:
f96e0b
 	movw %ax, %ds
f96e0b
 	lea message, %si
f96e0b
 	call serialmsg
f96e0b
-	lea shutdown, %si
f96e0b
-	movw $SHUTDOWN_PORT, %dx
f96e0b
-	call portmsg
f96e0b
+#include "qemu-shutdown-x86.S"
f96e0b
 
f96e0b
 1:
f96e0b
 	hlt
f96e0b
 	jmp 1b
f96e0b
 
f96e0b
-shutdown:
f96e0b
-	.ascii "Shutdown"
f96e0b
-	.byte 0
f96e0b
 message:
f96e0b
 	.ascii "Boot Test Passed Successfully\n" SUCCESSFUL_BOOT_STRING "\n"
f96e0b
 	.byte 0
f96e0b
diff --git a/grub-core/tests/boot/kernel-i386.S b/grub-core/tests/boot/kernel-i386.S
f96e0b
index 904b0d4..2154d3b 100644
f96e0b
--- a/grub-core/tests/boot/kernel-i386.S
f96e0b
+++ b/grub-core/tests/boot/kernel-i386.S
f96e0b
@@ -5,8 +5,6 @@
f96e0b
 #include <multiboot.h>
f96e0b
 #endif
f96e0b
 
f96e0b
-#define SHUTDOWN_PORT 0x8900
f96e0b
-
f96e0b
 	.text
f96e0b
 	/* Align 32 bits boundary.  */
f96e0b
 	.align	8
f96e0b
@@ -38,17 +36,6 @@ multiboot_header:
f96e0b
 #endif
f96e0b
 	
f96e0b
 	.global start
f96e0b
-portmsg:
f96e0b
-	xorl %eax, %eax
f96e0b
-1:	
f96e0b
-	movb 0(%esi), %al
f96e0b
-	test %eax, %eax
f96e0b
-	jz 1f
f96e0b
-	outb %al, %dx
f96e0b
-	incl %esi
f96e0b
-	jmp 1b
f96e0b
-1:
f96e0b
-	ret
f96e0b
 
f96e0b
 serialmsg:	
f96e0b
 1:	
f96e0b
@@ -73,17 +60,13 @@ serialmsg:
f96e0b
 _start:
f96e0b
 	lea message, %esi
f96e0b
 	call serialmsg
f96e0b
-	lea shutdown, %esi
f96e0b
-	movw $SHUTDOWN_PORT, %dx
f96e0b
-	call portmsg
f96e0b
+
f96e0b
+#include "qemu-shutdown-x86.S"
f96e0b
 
f96e0b
 1:
f96e0b
 	hlt
f96e0b
 	jmp 1b
f96e0b
 
f96e0b
-shutdown:
f96e0b
-	.ascii "Shutdown"
f96e0b
-	.byte 0
f96e0b
 message:
f96e0b
 	.ascii "Boot Test Passed Successfully\n" SUCCESSFUL_BOOT_STRING "\n"
f96e0b
 	.byte 0
f96e0b
diff --git a/grub-core/tests/boot/kfreebsd.init-i386.S b/grub-core/tests/boot/kfreebsd.init-i386.S
f96e0b
index 12c94a0..a448152 100644
f96e0b
--- a/grub-core/tests/boot/kfreebsd.init-i386.S
f96e0b
+++ b/grub-core/tests/boot/kfreebsd.init-i386.S
f96e0b
@@ -24,13 +24,12 @@
f96e0b
 #define SYSCALL_FSYNC 95
f96e0b
 #define SYSCALL_ARCH 165
f96e0b
 #define SYSCALL_EXIT 1
f96e0b
-#define SYSCALL_ARCH_IOPL	4
f96e0b
+#define SYSCALL_ARCH_IOPERM	4
f96e0b
 #define SYSCALL_INT 0x80
f96e0b
 
f96e0b
 #define RESET_NOSYNC 0x4
f96e0b
 #define RESET_HALT 0x8
f96e0b
 #define RESET_POWEROFF 0x4000
f96e0b
-#define SHUTDOWN_PORT 0x8900
f96e0b
 
f96e0b
 	.section ".init", "ax"
f96e0b
 	.global start,_start
f96e0b
@@ -64,31 +63,23 @@ _start:
f96e0b
 	int $SYSCALL_INT
f96e0b
 	addl $8, %esp
f96e0b
 
f96e0b
-	/* IOPL.  */
f96e0b
+	/* IOPERM.  */
f96e0b
 	movl $SYSCALL_ARCH, %eax
f96e0b
-	pushl $iopl_arg
f96e0b
-	pushl $SYSCALL_ARCH_IOPL
f96e0b
+	pushl $iopl_arg1
f96e0b
+	pushl $SYSCALL_ARCH_IOPERM
f96e0b
 	pushl $0
f96e0b
 	int $SYSCALL_INT
f96e0b
 	addl $12, %esp
f96e0b
-	
f96e0b
-	movw $SHUTDOWN_PORT, %dx
f96e0b
-	movb $'S', %al
f96e0b
-	outb %al, %dx
f96e0b
-	movb $'h', %al
f96e0b
-	outb %al, %dx
f96e0b
-	movb $'u', %al
f96e0b
-	outb %al, %dx
f96e0b
-	movb $'t', %al
f96e0b
-	outb %al, %dx
f96e0b
-	movb $'d', %al
f96e0b
-	outb %al, %dx
f96e0b
-	movb $'o', %al
f96e0b
-	outb %al, %dx
f96e0b
-	movb $'w', %al
f96e0b
-	outb %al, %dx
f96e0b
-	movb $'n', %al
f96e0b
-	outb %al, %dx
f96e0b
+
f96e0b
+	/* IOPERM.  */
f96e0b
+	movl $SYSCALL_ARCH, %eax
f96e0b
+	pushl $iopl_arg2
f96e0b
+	pushl $SYSCALL_ARCH_IOPERM
f96e0b
+	pushl $0
f96e0b
+	int $SYSCALL_INT
f96e0b
+	addl $12, %esp
f96e0b
+
f96e0b
+#include "qemu-shutdown-x86.S"
f96e0b
 	
f96e0b
 	/* shutdown.  */
f96e0b
 	movl $SYSCALL_RESET, %eax
f96e0b
@@ -108,7 +99,11 @@ device:
f96e0b
 message:
f96e0b
 	.ascii "Boot Test Passed Successfully\n" SUCCESSFUL_BOOT_STRING "\n"
f96e0b
 messageend:
f96e0b
-iopl_arg:
f96e0b
-	.long SHUTDOWN_PORT
f96e0b
+ioperm_arg1:
f96e0b
+	.long 0xcf8
f96e0b
+	.long 8
f96e0b
 	.long 1
f96e0b
+ioperm_arg2:
f96e0b
+	.long 0x1000
f96e0b
+	.long 8
f96e0b
 	.long 1
f96e0b
diff --git a/grub-core/tests/boot/kfreebsd.init-x86_64.S b/grub-core/tests/boot/kfreebsd.init-x86_64.S
f96e0b
index 0a9ff51..de7bab6 100644
f96e0b
--- a/grub-core/tests/boot/kfreebsd.init-x86_64.S
f96e0b
+++ b/grub-core/tests/boot/kfreebsd.init-x86_64.S
f96e0b
@@ -23,13 +23,12 @@
f96e0b
 #define SYSCALL_WRITE 4
f96e0b
 #define SYSCALL_RESET 55
f96e0b
 #define SYSCALL_EXIT 1
f96e0b
-#define SYSCALL_ARCH_IOPL	4
f96e0b
+#define SYSCALL_ARCH_IOPERM	4
f96e0b
 #define SYSCALL_FSYNC 95
f96e0b
 
f96e0b
 #define RESET_NOSYNC 0x4
f96e0b
 #define RESET_HALT 0x8
f96e0b
 #define RESET_POWEROFF 0x4000
f96e0b
-#define SHUTDOWN_PORT 0x8900
f96e0b
 
f96e0b
 	.section ".init", "ax"
f96e0b
 	.global start,_start
f96e0b
@@ -53,29 +52,18 @@ _start:
f96e0b
 	movq $SYSCALL_FSYNC, %rax
f96e0b
 	syscall
f96e0b
 
f96e0b
-	/* IOPL.  */
f96e0b
+	/* IOPERM.  */
f96e0b
 	movq $SYSCALL_ARCH, %rax
f96e0b
-	movq $SYSCALL_ARCH_IOPL, %rdi
f96e0b
-	leaq iopl_arg, %rsi
f96e0b
+	movq $SYSCALL_ARCH_IOPERM, %rdi
f96e0b
+	leaq ioperm_arg1, %rsi
f96e0b
 	syscall
f96e0b
 
f96e0b
-	movw $SHUTDOWN_PORT, %dx
f96e0b
-	movb $'S', %al
f96e0b
-	outb %al, %dx
f96e0b
-	movb $'h', %al
f96e0b
-	outb %al, %dx
f96e0b
-	movb $'u', %al
f96e0b
-	outb %al, %dx
f96e0b
-	movb $'t', %al
f96e0b
-	outb %al, %dx
f96e0b
-	movb $'d', %al
f96e0b
-	outb %al, %dx
f96e0b
-	movb $'o', %al
f96e0b
-	outb %al, %dx
f96e0b
-	movb $'w', %al
f96e0b
-	outb %al, %dx
f96e0b
-	movb $'n', %al
f96e0b
-	outb %al, %dx
f96e0b
+	movq $SYSCALL_ARCH, %rax
f96e0b
+	movq $SYSCALL_ARCH_IOPERM, %rdi
f96e0b
+	leaq ioperm_arg2, %rsi
f96e0b
+	syscall
f96e0b
+
f96e0b
+#include "qemu-shutdown-x86.S"
f96e0b
 	
f96e0b
 	/* shutdown.  */
f96e0b
 	movq $SYSCALL_RESET, %rax
f96e0b
@@ -92,7 +80,11 @@ device:
f96e0b
 message:
f96e0b
 	.ascii "Boot Test Passed Successfully\n" SUCCESSFUL_BOOT_STRING "\n"
f96e0b
 messageend:
f96e0b
-iopl_arg:
f96e0b
-	.long SHUTDOWN_PORT
f96e0b
+ioperm_arg1:
f96e0b
+	.long 0xcf8
f96e0b
+	.long 8
f96e0b
 	.long 1
f96e0b
+ioperm_arg2:
f96e0b
+	.long 0x1000
f96e0b
+	.long 8
f96e0b
 	.long 1
f96e0b
diff --git a/grub-core/tests/boot/linux.init-i386.S b/grub-core/tests/boot/linux.init-i386.S
f96e0b
index 5b0088e..c0983ac 100644
f96e0b
--- a/grub-core/tests/boot/linux.init-i386.S
f96e0b
+++ b/grub-core/tests/boot/linux.init-i386.S
f96e0b
@@ -27,8 +27,6 @@
f96e0b
 #define SHUTDOWN_MAGIC2 0x28121969
f96e0b
 #define SHUTDOWN_MAGIC3 0x4321fedc
f96e0b
 
f96e0b
-#define SHUTDOWN_PORT 0x8900
f96e0b
-
f96e0b
 	.text
f96e0b
 	.global start, _start
f96e0b
 _start:
f96e0b
@@ -44,23 +42,7 @@ start:
f96e0b
 	movl $3, %ebx
f96e0b
 	int $SYSCALL_INT
f96e0b
 
f96e0b
-	movw $SHUTDOWN_PORT, %dx
f96e0b
-	movb $'S', %al
f96e0b
-	outb %al, %dx
f96e0b
-	movb $'h', %al
f96e0b
-	outb %al, %dx
f96e0b
-	movb $'u', %al
f96e0b
-	outb %al, %dx
f96e0b
-	movb $'t', %al
f96e0b
-	outb %al, %dx
f96e0b
-	movb $'d', %al
f96e0b
-	outb %al, %dx
f96e0b
-	movb $'o', %al
f96e0b
-	outb %al, %dx
f96e0b
-	movb $'w', %al
f96e0b
-	outb %al, %dx
f96e0b
-	movb $'n', %al
f96e0b
-	outb %al, %dx
f96e0b
+#include "qemu-shutdown-x86.S"
f96e0b
 	
f96e0b
 	/* shutdown.  */
f96e0b
 	movl $SYSCALL_RESET, %eax
f96e0b
diff --git a/grub-core/tests/boot/linux.init-x86_64.S b/grub-core/tests/boot/linux.init-x86_64.S
f96e0b
index fc32dfd..90bdcc3 100644
f96e0b
--- a/grub-core/tests/boot/linux.init-x86_64.S
f96e0b
+++ b/grub-core/tests/boot/linux.init-x86_64.S
f96e0b
@@ -26,8 +26,6 @@
f96e0b
 #define SHUTDOWN_MAGIC2 0x28121969
f96e0b
 #define SHUTDOWN_MAGIC3 0x4321fedc
f96e0b
 
f96e0b
-#define SHUTDOWN_PORT 0x8900
f96e0b
-
f96e0b
 	.text
f96e0b
 	.global start, _start
f96e0b
 _start:
f96e0b
@@ -43,23 +41,7 @@ start:
f96e0b
 	movq $3, %rdi
f96e0b
 	syscall
f96e0b
 
f96e0b
-	movw $SHUTDOWN_PORT, %dx
f96e0b
-	movb $'S', %al
f96e0b
-	outb %al, %dx
f96e0b
-	movb $'h', %al
f96e0b
-	outb %al, %dx
f96e0b
-	movb $'u', %al
f96e0b
-	outb %al, %dx
f96e0b
-	movb $'t', %al
f96e0b
-	outb %al, %dx
f96e0b
-	movb $'d', %al
f96e0b
-	outb %al, %dx
f96e0b
-	movb $'o', %al
f96e0b
-	outb %al, %dx
f96e0b
-	movb $'w', %al
f96e0b
-	outb %al, %dx
f96e0b
-	movb $'n', %al
f96e0b
-	outb %al, %dx
f96e0b
+#include "qemu-shutdown-x86.S"
f96e0b
 	
f96e0b
 	/* shutdown.  */
f96e0b
 	movq $SYSCALL_RESET, %rax
f96e0b
diff --git a/grub-core/tests/boot/qemu-shutdown-x86.S b/grub-core/tests/boot/qemu-shutdown-x86.S
f96e0b
new file mode 100644
f96e0b
index 0000000..8f794fc
f96e0b
--- /dev/null
f96e0b
+++ b/grub-core/tests/boot/qemu-shutdown-x86.S
f96e0b
@@ -0,0 +1,9 @@
f96e0b
+	movl $0x80000b40, %eax
f96e0b
+	movw $0xcf8, %dx
f96e0b
+	outl  %eax, %dx
f96e0b
+	movl $0x1001, %eax
f96e0b
+	movw $0xcfc, %dx
f96e0b
+	outl  %eax, %dx
f96e0b
+	movw $0x2000, %ax
f96e0b
+	movw $0x1004, %dx	
f96e0b
+	outw  %ax, %dx
f96e0b
-- 
f96e0b
1.8.2.1
f96e0b