Module Name:    src
Committed By:   maxv
Date:           Sun Jul 24 13:04:58 UTC 2016

Modified Files:
        src/sys/arch/amd64/acpi: acpi_wakecode.S acpi_wakeup_low.S
        src/sys/arch/i386/acpi: acpi_wakecode.S acpi_wakeup_low.S

Log Message:
KNF, and reduce the diff between amd64 and i386.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/amd64/acpi/acpi_wakecode.S
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/amd64/acpi/acpi_wakeup_low.S
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/i386/acpi/acpi_wakecode.S
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/i386/acpi/acpi_wakeup_low.S

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.12 src/sys/arch/amd64/acpi/acpi_wakecode.S:1.13
--- src/sys/arch/amd64/acpi/acpi_wakecode.S:1.12	Wed Jan 15 22:24:41 2014
+++ src/sys/arch/amd64/acpi/acpi_wakecode.S	Sun Jul 24 13:04:58 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_wakecode.S,v 1.12 2014/01/15 22:24:41 joerg Exp $	*/
+/*	$NetBSD: acpi_wakecode.S,v 1.13 2016/07/24 13:04:58 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2007 Joerg Sonnenberger <jo...@netbsd.org>
@@ -31,7 +31,6 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-
 /*
  * This code is derived from FreeBSD.  Original copyrights:
  *
@@ -144,7 +143,7 @@ wakeup_16:
 	data32 addr32 lgdt	tmp_gdt
 #endif
 
-	/* Enable protected mode w/o paging */
+	/* Enable protected mode without paging */
 	mov	%cr0,%eax
 	orl	$(CR0_PE),%eax
 	mov	%eax,%cr0
@@ -164,10 +163,10 @@ wakeup_32:
 	/*
 	 * Switched to protected mode w/o paging
 	 */
-
 	nop
+
 	/* Set up segment registers and initial stack for protected mode */
-	movw	$0x10, %ax
+	movw	$0x10,%ax
 	movw	%ax,%ds
 	movw	%ax,%ss
 
@@ -193,7 +192,7 @@ wakeup_32:
 	movl	WAKEUP_efer + ACPI_WAKEUP_ADDR,%ebx
 	movl	$MSR_EFER,%ecx
 	rdmsr
-	orl	$EFER_LME, %eax
+	orl	$EFER_LME,%eax
 	wrmsr
 
 	/* Load temporary PML4, code will switch to full PML4 later */
@@ -204,9 +203,11 @@ wakeup_32:
 	movl	%cr0,%eax
 	orl	$(CR0_PE|CR0_PG|CR0_NE|CR0_TS|CR0_MP|CR0_WP|CR0_AM),%eax
 	movl	%eax,%cr0
-	/* Flush prefetch queue */
+
+	/* Flush the prefetch queue */
 	jmp	1f
 1:
+
 	/* Switch to temporary 64bit GDT */
 	lgdt	tmp_gdt64 + ACPI_WAKEUP_ADDR
 
@@ -220,7 +221,7 @@ wakeup_64:
 	 * Load the normal system value of MSR EFER.  This includes
 	 * enabling the SYSCALL extension and NXE (if supported).
 	 */
-	movl	%ebx, %eax
+	movl	%ebx,%eax
 	movl	$MSR_EFER,%ecx
 	wrmsr
 
@@ -228,6 +229,7 @@ wakeup_64:
 	movw	$GSEL(GDATA_SEL, SEL_KPL),%ax
 	movw	%ax,%ds
 
+	/* Restore registers */
 	movq	WAKEUP_curcpu + ACPI_WAKEUP_ADDR,%r8
 	movq	WAKEUP_restorecpu + ACPI_WAKEUP_ADDR,%rbx
 
@@ -270,7 +272,7 @@ WAKEUP_restorecpu:	.quad 0
 	.global WAKEUP_vbios_reset
 WAKEUP_vbios_reset:	.byte 0
 	.global WAKEUP_vesa_modenum
-WAKEUP_vesa_modenum:    .word 0
+WAKEUP_vesa_modenum:	.word 0
 	.global WAKEUP_beep_on_reset
 WAKEUP_beep_on_reset:	.byte 0
 

Index: src/sys/arch/amd64/acpi/acpi_wakeup_low.S
diff -u src/sys/arch/amd64/acpi/acpi_wakeup_low.S:1.4 src/sys/arch/amd64/acpi/acpi_wakeup_low.S:1.5
--- src/sys/arch/amd64/acpi/acpi_wakeup_low.S:1.4	Sun May 11 15:32:20 2008
+++ src/sys/arch/amd64/acpi/acpi_wakeup_low.S	Sun Jul 24 13:04:58 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_wakeup_low.S,v 1.4 2008/05/11 15:32:20 ad Exp $	*/
+/*	$NetBSD: acpi_wakeup_low.S,v 1.5 2016/07/24 13:04:58 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2007 Joerg Sonnenberger <jo...@netbsd.org>
@@ -80,7 +80,7 @@ acpi_md_sleep_exit:
 	movq	ACPI_SUSPEND_CR0(%r8),%rax
 	movq	%rax,%cr0
 
-	jmp 1f
+	jmp	1f
 1:
 
 	movq	CPUVAR(GDT),%rax
@@ -88,7 +88,7 @@ acpi_md_sleep_exit:
 	andq	$~0x0200,4(%rax,%rdx, 1)
 
 	ltr	%dx
-	lldt 	ACPI_SUSPEND_LDT(%r8)
+	lldt	ACPI_SUSPEND_LDT(%r8)
 	lidt	ACPI_SUSPEND_IDT(%r8)
 
 	movq	ACPI_SUSPEND_REG+(0*8)(%r8),%rsp

Index: src/sys/arch/i386/acpi/acpi_wakecode.S
diff -u src/sys/arch/i386/acpi/acpi_wakecode.S:1.16 src/sys/arch/i386/acpi/acpi_wakecode.S:1.17
--- src/sys/arch/i386/acpi/acpi_wakecode.S:1.16	Sun Feb  2 22:41:20 2014
+++ src/sys/arch/i386/acpi/acpi_wakecode.S	Sun Jul 24 13:04:58 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_wakecode.S,v 1.16 2014/02/02 22:41:20 dsl Exp $	*/
+/*	$NetBSD: acpi_wakecode.S,v 1.17 2016/07/24 13:04:58 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -29,7 +29,6 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-
 /*
  * This code is derived from FreeBSD.  Original copyrights:
  *
@@ -136,14 +135,13 @@ wakeup_16:
 	/* Load GDT while non-paging */
 	lgdt	tmp_gdt
 
-	/* Enable protected mode */
+	/* Enable protected mode without paging */
 	mov	%cr0,%eax
 	orl	$(CR0_PE),%eax
 	mov	%eax,%cr0
 
 	/* Switch to protected mode by intersegmental jump */
-	ljmpl	$0x8,$wakeup_32	+ ACPI_WAKEUP_ADDR
-
+	ljmpl	$0x8,$wakeup_32 + ACPI_WAKEUP_ADDR
 
 	.code32
 	.align	16
@@ -151,19 +149,21 @@ wakeup_32:
 	/*
 	 * Switched to protected mode w/o paging
 	 */
-
 	nop
+
 	/* Set up segment registers for protected mode */
 	movw	$GSEL(GDATA_SEL,SEL_KPL),%ax
 	movw	%ax,%ds
 
-	/* Restore PSE and other settings before enabling paging. */
+	/* Enable potentially PSE and PAE */
 	movl	WAKEUP_r_cr4 + ACPI_WAKEUP_ADDR,%eax
 	movl	%eax,%cr4
 
-	/* Enable paging (assumes identical mapping) */
+	/* Load temporary page table, we will switch to full page table later */
 	movl	WAKEUP_r_cr3 + ACPI_WAKEUP_ADDR,%eax
 	movl	%eax,%cr3
+
+	/* Enable paging */
 	movl	%cr0,%eax
 	orl	$(CR0_PE|CR0_PG|CR0_NE|CR0_TS|CR0_MP|CR0_WP|CR0_AM),%eax
 	movl	%eax,%cr0
@@ -179,6 +179,7 @@ wakeup_32:
 	movl	WAKEUP_curcpu + ACPI_WAKEUP_ADDR,%edx
 	movl	WAKEUP_restorecpu + ACPI_WAKEUP_ADDR,%ebx
 
+	/* Continue with wakeup in the high-level wakeup code */
 	jmp	*%ebx
 
 	.align	8

Index: src/sys/arch/i386/acpi/acpi_wakeup_low.S
diff -u src/sys/arch/i386/acpi/acpi_wakeup_low.S:1.5 src/sys/arch/i386/acpi/acpi_wakeup_low.S:1.6
--- src/sys/arch/i386/acpi/acpi_wakeup_low.S:1.5	Sun May 11 15:32:20 2008
+++ src/sys/arch/i386/acpi/acpi_wakeup_low.S	Sun Jul 24 13:04:58 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_wakeup_low.S,v 1.5 2008/05/11 15:32:20 ad Exp $	*/
+/*	$NetBSD: acpi_wakeup_low.S,v 1.6 2016/07/24 13:04:58 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2007 Joerg Sonnenberger <jo...@netbsd.org>
@@ -29,7 +29,7 @@
  */
 
 #include <machine/asm.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_wakeup_low.S,v 1.5 2008/05/11 15:32:20 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_wakeup_low.S,v 1.6 2016/07/24 13:04:58 maxv Exp $");
 
 #include "assym.h"
 #include <machine/segments.h>
@@ -53,13 +53,12 @@ acpi_md_sleep_exit:
 
 	movl	ACPI_SUSPEND_CR2(%edx),%eax
 	movl	%eax,%cr2
-
 	movl	ACPI_SUSPEND_CR4(%edx),%eax
 	movl	%eax,%cr4
 	movl	ACPI_SUSPEND_CR3(%edx),%eax
 	movl	%eax,%cr3
 
-	jmp 1f
+	jmp	1f
 1:
 
 	lidt	ACPI_SUSPEND_IDT(%edx)

Reply via email to