login
Header Space

 
 

Re: [rft] s2ram wakeup moves to .c, could fix few machines

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Sam Ravnborg <sam@...>
Cc: Rafael J. Wysocki <rjw@...>, kernel list <linux-kernel@...>, Linux-pm mailing list <linux-pm@...>, H. Peter Anvin <hpa@...>
Date: Friday, February 8, 2008 - 5:49 pm

Hi!

This cleans up .lds, making use of constants...

								Pavel

diff --git a/arch/x86/kernel/acpi/realmode/wakeup.h b/arch/x86/kernel/acpi/realmode/wakeup.h
index 4a26e27..ee7c68b 100644
--- a/arch/x86/kernel/acpi/realmode/wakeup.h
+++ b/arch/x86/kernel/acpi/realmode/wakeup.h
@@ -6,6 +6,7 @@
 #ifndef ARCH_X86_KERNEL_ACPI_RM_WAKEUP_H
 #define ARCH_X86_KERNEL_ACPI_RM_WAKEUP_H
 
+#ifndef __ASSEMBLY__
 #include <linux/types.h>
 
 /* This must match data at wakeup.S */
@@ -27,5 +28,10 @@ struct wakeup_header {
 	u16 trampoline_segment;
 	u32 signature;		/* To check we have correct structure */
 } __attribute__((__packed__));
+#endif
+
+#define HEADER_OFFSET 0x3f00
+#define WAKEUP_SIZE   0x4000
+
 
 #endif /* ARCH_X86_KERNEL_ACPI_RM_WAKEUP_H */
diff --git a/arch/x86/kernel/acpi/realmode/wakeup.lds.S b/arch/x86/kernel/acpi/realmode/wakeup.lds.S
index 24ebe75..22fab6c 100644
--- a/arch/x86/kernel/acpi/realmode/wakeup.lds.S
+++ b/arch/x86/kernel/acpi/realmode/wakeup.lds.S
@@ -4,6 +4,7 @@
  * Linker script for the real-mode wakeup code
  */
 #undef i386
+#include "wakeup.h"
 
 OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
 OUTPUT_ARCH(i386)
@@ -11,7 +12,7 @@ ENTRY(_start)
 
 SECTIONS
 {
-	. = 0x3f00;
+	. = HEADER_OFFSET;
 	.header : {
 		 *(.header)
 	}
@@ -56,7 +57,5 @@ SECTIONS
 		*(.note*)
 	}
 
-	/* Adjust this as appropriate */
-	/* This allows 4 pages (16K) */
-	. = ASSERT(_end <= 0x4000, "Wakeup too big!");
+	. = ASSERT(_end <= WAKEUP_SIZE, "Wakeup too big!");
 }
diff --git a/arch/x86/kernel/acpi/sleep.c b/arch/x86/kernel/acpi/sleep.c
index 1b282b1..561565e 100644
--- a/arch/x86/kernel/acpi/sleep.c
+++ b/arch/x86/kernel/acpi/sleep.c
@@ -53,9 +53,9 @@ int acpi_save_state_mem(void)
 		       "S3 disabled\n");
 		return -ENOMEM;
 	}
-	memcpy((void *)acpi_realmode, &wakeup_code_start, 4*PAGE_SIZE);
+	memcpy((void *)acpi_realmode, &wakeup_code_start, WAKEUP_SIZE);
 
-	header = (struct wakeup_header *)(acpi_realmode + 0x3f00);
+	header = (struct wakeup_header *)(acpi_realmode + HEADER_OFFSET);
 	if (header->signature != 0x51ee1111) {
 		printk(KERN_ERR "wakeup header does not match\n");
 		return -EINVAL;
@@ -111,13 +111,13 @@ void acpi_restore_state_mem(void)
  */
 void __init acpi_reserve_bootmem(void)
 {
-	if ((&wakeup_code_end - &wakeup_code_start) > PAGE_SIZE*4) {
+	if ((&wakeup_code_end - &wakeup_code_start) > WAKEUP_SIZE) {
 		printk(KERN_ERR
 		       "ACPI: Wakeup code way too big, S3 disabled.\n");
 		return;
 	}
 
-	acpi_realmode = (unsigned long)alloc_bootmem_low(PAGE_SIZE*4);
+	acpi_realmode = (unsigned long)alloc_bootmem_low(WAKEUP_SIZE);
 
 	if (!acpi_realmode) {
 		printk(KERN_ERR "ACPI: Cannot allocate lowmem, S3 disabled.\n");




-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[rft] s2ram wakeup moves to .c, could fix few machines, Pavel Machek, (Tue Feb 5, 3:06 pm)
Re: [rft] s2ram wakeup moves to .c, could fix few machines, Rafael J. Wysocki, (Wed Feb 6, 7:37 pm)
Re: [rft] s2ram wakeup moves to .c, could fix few machines, Rafael J. Wysocki, (Tue Feb 5, 9:27 pm)
Re: [rft] s2ram wakeup moves to .c, could fix few machines, Rafael J. Wysocki, (Wed Feb 6, 7:48 pm)
Re: [rft] s2ram wakeup moves to .c, could fix few machines, Rafael J. Wysocki, (Thu Feb 7, 6:12 pm)
Re: [rft] s2ram wakeup moves to .c, could fix few machines, Rafael J. Wysocki, (Fri Feb 8, 6:01 pm)
Re: [rft] s2ram wakeup moves to .c, could fix few machines, Rafael J. Wysocki, (Fri Feb 8, 8:18 pm)
Re: [rft] s2ram wakeup moves to .c, could fix few machines, Rafael J. Wysocki, (Sat Feb 9, 9:48 am)
Re: [rft] s2ram wakeup moves to .c, could fix few machines, Rafael J. Wysocki, (Thu Feb 7, 7:06 pm)
Re: [rft] s2ram wakeup moves to .c, could fix few machines, Rafael J. Wysocki, (Fri Feb 8, 12:23 pm)
Re: [rft] s2ram wakeup moves to .c, could fix few machines, Rafael J. Wysocki, (Thu Feb 7, 7:36 pm)
Re: [rft] s2ram wakeup moves to .c, could fix few machines, Rafael J. Wysocki, (Thu Feb 7, 6:57 pm)
Re: [rft] s2ram wakeup moves to .c, could fix few machines, Rafael J. Wysocki, (Thu Feb 7, 7:09 pm)
Re: [rft] s2ram wakeup moves to .c, could fix few machines, Rafael J. Wysocki, (Thu Feb 7, 6:40 pm)
Re: [rft] s2ram wakeup moves to .c, could fix few machines, Rafael J. Wysocki, (Thu Feb 7, 6:53 pm)
Re: [rft] s2ram wakeup moves to .c, could fix few machines, Pavel Machek, (Fri Feb 8, 5:49 pm)
Re: [rft] s2ram wakeup moves to .c, could fix few machines, Rafael J. Wysocki, (Tue Feb 5, 9:42 pm)
Re: [rft] s2ram wakeup moves to .c, could fix few machines, Bill Davidsen, (Wed Feb 13, 10:54 pm)
Re: [rft] s2ram wakeup moves to .c, could fix few machines, Rafael J. Wysocki, (Tue Feb 5, 9:56 pm)
speck-geostationary