move wakeup code to .c
Subsystems (4)
PATCH 1/1 move wakeup code to .c
I think .c wakeup code is ready for some more testing. HPA and Rafael did coding, so I added them as signed-off-by:. (Plus Rafael actually thinks its ready for -mm, I agree.)
Pavel
---
Move wakeup code to .c, so that video mode setting code can be shared between boot and wakeup. Remove nasty assembly code in 64-bit case by re-using trampoline code. Stack setup was fixed to clear high 16bits of %esp, maybe that fixes some machines.
.c code sharing and morse code was done H. Peter Anvin, Sam Ravnborg reviewed kbuild related stuff, and it seems okay to him. Rafael did some cleanups.
arch/x86/boot/Makefile +1 -1
@@ -30,7 +30,7 @@ subdir- := compressed setup-y += a20.o cmdline.o copy.o cpu.o cpucheck.o edd.o setup-y += header.o main.o mca.o memory.o pm.o pmjump.o -setup-y += printf.o string.o tty.o video.o version.o +setup-y += printf.o string.o tty.o video.o video-mode.o version.o setup-$(CONFIG_X86_APM_BOOT) += apm.o setup-$(CONFIG_X86_VOYAGER) += voyager.o
arch/x86/boot/boot.h +5 -0
@@ -286,6 +286,11 @@ int getchar_timeout(void);/* video.c */ void set_video (void ); +/* video-mode.c */ +int set_mode (u16 mode); +int mode_defined (u16 mode); +void probe_cards (int unsafe); +/* video-vesa.c */ void vesa_store_edid (void );
arch/x86/boot/video-bios.c +6 -0
@@ -50,6 +50,7 @@ static int set_bios_mode(u8 mode)if (new_mode == mode)return 0 ;/* Mode change OK */ +#ifndef _WAKEUPif (new_mode != boot_params.screen_info.orig_video_mode) {/* Mode setting failed, but we didn't end up where we started. That's bad. Try to revert to the original
@@ -59,13 +60,18 @@ static int set_bios_mode(u8 mode) : "+a" (ax) : : "ebx", "ecx", "edx", "esi", "edi"); } +#endif return -1 ; }static int bios_probe (void ) {u8 mode; +#ifdef _WAKEUP +u8 saved_mode =0x03 ; +#else u8 saved_mode = boot_params.screen_info.orig_video_mode; +#endif u16 crtc;struct mode_info *mi;int nmodes =0 ;
arch/x86/boot/video-mode.c new file +173 -0
173 lines not on this page · raw message
arch/x86/boot/video-vesa.c +8 -0
@@ -24,7 +24,11 @@ static struct vesa_mode_info vminfo;__videocard video_vesa; +#ifndef _WAKEUPstatic void vesa_store_mode_params_graphics (void ); +#else /* _WAKEUP */ +static inline void vesa_store_mode_params_graphics (void ) {} +#endif /* _WAKEUP */ static int vesa_probe (void ) {
@@ -167,6 +171,8 @@ static int vesa_set_mode(struct mode_inf } +#ifndef _WAKEUP +/* Switch DAC to 8-bit mode */ static void vesa_dac_set_8bits (void ) {
@@ -290,6 +296,8 @@ #ifdef CONFIG_FIRMWARE_EDID#endif /* CONFIG_FIRMWARE_EDID */ } +#endif /* not _WAKEUP */ +__videocard video_vesa = { .card_name ="VESA" ,
arch/x86/boot/video-vga.c +10 -2
@@ -210,6 +210,8 @@ static int vga_set_mode(struct mode_info*/ static int vga_probe (void ) { +u16 ega_bx; +static const char *card_name[] = {"CGA/MDA/HGC" ,"EGA" ,"VGA" };
@@ -226,12 +228,16 @@ static int vga_probe(void)u8 vga_flag; asm(INT10 - : "=b" (boot_params.screen_info.orig_video_ega_bx) + : "=b" (ega_bx) : "a" (0x1200), "b" (0x10) /* Check EGA/VGA */ : "ecx", "edx", "esi", "edi"); +#ifndef _WAKEUP + boot_params.screen_info.orig_video_ega_bx = ega_bx; +#endif +/* If we have MDA/CGA/HGC then BL will be unchanged at 0x10 */ -if ((u8 )boot_params.screen_info.orig_video_ega_bx !=0x10 ) { +if ((u8 )ega_bx !=0x10 ) {/* EGA/VGA */ asm(INT10 : "=a" (vga_flag)
@@ -240,7 +246,9 @@ static int vga_probe(void)if (vga_flag ==0x1a ) { adapter =ADAPTER_VGA ; +#ifndef _WAKEUP boot_params.screen_info.orig_video_isVGA =1 ; +#endif }else { adapter =ADAPTER_EGA ; }
arch/x86/boot/video.c +1 -156
175 lines not on this page · raw message
arch/x86/kernel/acpi/Makefile +8 -1
@@ -1,7 +1,14 @@ +subdir- := realmode + obj-$(CONFIG_ACPI) += boot.o -obj-$(CONFIG_ACPI_SLEEP) += sleep.o wakeup_$(BITS).o +obj-$(CONFIG_ACPI_SLEEP) += sleep.o wakeup_rm.o wakeup_$(BITS).o ifneq ($(CONFIG_ACPI_PROCESSOR),) obj-y += cstate.o processor.o endif +$(obj)/wakeup_rm.o: $(obj)/realmode/wakeup.bin + +$(obj)/realmode/wakeup.bin: FORCE + $(Q)$(MAKE) $(build)=$(obj)/realmode $@ +
arch/x86/kernel/acpi/realmode/Makefile new file +58 -0
58 lines not on this page · raw message
arch/x86/kernel/acpi/realmode/copy.S new file +1 -0
@@ -0,0 +1 @@ +#include "../../../boot/copy.S"
arch/x86/kernel/acpi/realmode/video-bios.c new file +1 -0
@@ -0,0 +1 @@ +#include "../../../boot/video-bios.c"
arch/x86/kernel/acpi/realmode/video-mode.c new file +1 -0
@@ -0,0 +1 @@ +#include "../../../boot/video-mode.c"
arch/x86/kernel/acpi/realmode/video-vesa.c new file +1 -0
@@ -0,0 +1 @@ +#include "../../../boot/video-vesa.c"
arch/x86/kernel/acpi/realmode/video-vga.c new file +1 -0
@@ -0,0 +1 @@ +#include "../../../boot/video-vga.c"
arch/x86/kernel/acpi/realmode/wakemain.c new file +83 -0
83 lines not on this page · raw message
arch/x86/kernel/acpi/realmode/wakeup.S new file +113 -0
113 lines not on this page · raw message
arch/x86/kernel/acpi/realmode/wakeup.h new file +35 -0
@@ -0,0 +1,35 @@ +/* +* Definitions for the wakeup data structure at the head of the +* wakeup code. +*/ + +#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 */ +struct wakeup_header { +u16 video_mode;/* Video mode number */ +u16 _jmp1;/* ljmpl opcode, 32-bit only */ +u32 pmode_entry;/* Protected mode resume point, 32-bit only */ +u16 _jmp2;/* CS value, 32-bit only */ +u32 pmode_cr0;/* Protected mode cr0 */ +u32 pmode_cr3;/* Protected mode cr3 */ +u32 pmode_cr4;/* Protected mode cr4 */ +u32 pmode_efer_low;/* Protected mode EFER */ +u32 pmode_efer_high; +u64 pmode_gdt; +u32 realmode_flags; +u32 real_magic; +u16 trampoline_segment;/* segment with trampoline code, 64-bit only */ +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 */
arch/x86/kernel/acpi/realmode/wakeup.lds.S new file +61 -0
61 lines not on this page · raw message
arch/x86/kernel/acpi/sleep.c +70 -10
114 lines not on this page · raw message
arch/x86/kernel/acpi/wakeup_32.S +20 -227
287 lines not on this page · raw message
arch/x86/kernel/acpi/wakeup_64.S +9 -304
337 lines not on this page · raw message
arch/x86/kernel/acpi/wakeup_rm.S new file +10 -0
@@ -0,0 +1,10 @@ +/* + * Wrapper script for the realmode binary as a transport object + * before copying to low memory. + */ + .section ".rodata","a" + .globl wakeup_code_start, wakeup_code_end +wakeup_code_start: + .incbin "arch/x86/kernel/acpi/realmode/wakeup.bin" +wakeup_code_end: + .size wakeup_code_start, .-wakeup_code_start
arch/x86/kernel/head_64.S +0 -4
@@ -127,10 +127,6 @@ #ifdef CONFIG_SMP addq %rbp, trampoline_level4_pgt + 0(%rip) addq %rbp, trampoline_level4_pgt + (511*8)(%rip) #endif -#ifdef CONFIG_ACPI_SLEEP - addq %rbp, wakeup_level4_pgt + 0(%rip) - addq %rbp, wakeup_level4_pgt + (511*8)(%rip) -#endif /* Due to ENTRY(), sometimes the empty space gets filled with * zeros. Better take a jmp than relying on empty space being
arch/x86/kernel/setup_32.c +2 -2
@@ -186,7 +186,7 @@ #endifextern void early_cpu_init (void );extern int root_mountflags; -unsigned long saved_videomode; +unsigned long saved_video_mode;#define RAMDISK_IMAGE_START_MASK 0x07FF#define RAMDISK_PROMPT_FLAG 0x8000
@@ -713,7 +713,7 @@ #endif edid_info = boot_params.edid_info; apm_info.bios = boot_params.apm_bios_info; ist_info = boot_params.ist_info; - saved_videomode = boot_params.hdr.vid_mode; + saved_video_mode = boot_params.hdr.vid_mode;if ( boot_params.sys_desc_table.length !=0 ) {set_mca_bus (boot_params.sys_desc_table.table[3 ] &0x2 ); machine_id = boot_params.sys_desc_table.table[0 ];
arch/x86/kernel/smpboot_64.c +4 -1
@@ -132,7 +132,7 @@ #endif* has made sure it's suitably aligned. */ -static unsigned long __cpuinit setup_trampoline (void ) +unsigned long __cpuinit setup_trampoline (void ) {void *tramp =__va (SMP_TRAMPOLINE_BASE );memcpy (tramp, trampoline_data, trampoline_end - trampoline_data);
@@ -649,6 +649,9 @@ do_rest: *((volatile unsigned short *)phys_to_virt (0x467 )) = start_rip &0xf ;Dprintk ("3.\n" ); +/* Trampoline assumes it is at beggining of segment */ +BUG_ON (start_rip &0xf ); +/* * Be paranoid about clearing APIC errors. */
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Len Brown
reviewerscripts/checkpatch.pl
ERROR: do not initialise externals to 0 or NULL
#113: FILE: arch/x86/boot/video-mode.c:29:
+int do_restore = 0; /* Screen contents changed during mode flip */
WARNING: Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt #644: FILE: arch/x86/kernel/acpi/realmode/wakemain.c:4:
+extern volatile struct wakeup_header wakeup_header;
WARNING: externs should be avoided in .c files #644: FILE: arch/x86/kernel/acpi/realmode/wakemain.c:4:
+extern volatile struct wakeup_header wakeup_header;
ERROR: need a space before the open parenthesis '(' #710: FILE: arch/x86/kernel/acpi/realmode/wakemain.c:70:
+ while(1);
WARNING: externs should be avoided in .c files
#968: FILE: arch/x86/kernel/acpi/sleep.c:21:
+extern char wakeup_code_start, wakeup_code_end;
WARNING: externs should be avoided in .c files
#970: FILE: arch/x86/kernel/acpi/sleep.c:23:
+extern unsigned long setup_trampoline(void);
WARNING: externs should be avoided in .c files
#971: FILE: arch/x86/kernel/acpi/sleep.c:24:
+extern void wakeup_long64(void);
WARNING: externs should be avoided in .c files
#973: FILE: arch/x86/kernel/acpi/sleep.c:26:
+extern unsigned long saved_video_mode;
WARNING: externs should be avoided in .c files
#974: FILE: arch/x86/kernel/acpi/sleep.c:27:
+extern long saved_magic;
WARNING: Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt #975: FILE: arch/x86/kernel/acpi/sleep.c:28:
+extern volatile unsigned long init_rsp;
WARNING: externs should be avoided in .c files
#975: FILE: arch/x86/kernel/acpi/sleep.c:28:
+extern volatile unsigned long init_rsp;
WARNING: externs should be avoided in .c files
#976: FILE: arch/x86/kernel/acpi/sleep.c:29:
+extern void (*initial_code)(void);
WARNING: externs should be avoided in .c files
#978: FILE: arch/x86/kernel/acpi/sleep.c:31:
+extern int wakeup_pmode_return;
WARNING: externs should be avoided in .c files
#979: FILE: arch/x86/kernel/acpi/sleep.c:32:
+extern char swsusp_pg_dir[PAGE_SIZE];
WARNING: externs should be avoided in .c files
#984: FILE: arch/x86/kernel/acpi/sleep.c:37:
+extern unsigned long FASTCALL(acpi_copy_wakeup_routine(unsigned long));
total: 2 errors, 13 warnings, 1615 lines checked
/home/lenb/Documents/wakeup.patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
Hi!
Quoted 4 lines
scripts/checkpatch.pl
ERROR: do not initialise externals to 0 or NULL
#113: FILE:arch/x86/boot/video-mode.c:29:
+intdo_restore= 0; /* Screen contents changed during mode flip */
We were doing file move with minimal changes.
Quoted 3 lines
ERROR: need a space before the open parenthesis '(' #710: FILE:
arch/x86/kernel/acpi/realmode/wakemain.c:70:
+ while(1);
Bogus warning.
I'll fix al but this one, but could we do it as a followup patch? I'm currently at holidays, moving .S code into .c is rather good/important, and it should get testing ASAP.
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 13 lines · Pavel Machek
Hi!
Quoted 4 lines
scripts/checkpatch.pl
ERROR: do not initialise externals to 0 or NULL
#113: FILE:arch/x86/boot/video-mode.c:29:
+intdo_restore= 0; /* Screen contents changed during mode flip */We were doing file move with minimal changes.
Quoted 3 lines
ERROR: need a space before the open parenthesis '(' #710: FILE:
arch/x86/kernel/acpi/realmode/wakemain.c:70:
+ while(1);
Quoted 5 lines
Bogus warning.
I'll fix al but this one, but could we do it as a followup patch? I'm currently at holidays, moving .S code into .c is rather good/important, and it should get testing ASAP.
I'll move the definitions into a header file.
Thanks,
Rafael
Rafael J. Wysocki
Reviewed-by Sam RavnborgQuoted 61 lines · Len Brown
scripts/checkpatch.pl
ERROR: do not initialise externals to 0 or NULL
#113: FILE:arch/x86/boot/video-mode.c:29:
+intdo_restore= 0; /* Screen contents changed during mode flip */WARNING: Use of volatile is usually wrong: see
Documentation/volatile-considered-harmful.txt#644: FILE:arch/x86/kernel/acpi/realmode/wakemain.c:4:
+extern volatile structwakeup_headerwakeup_header;WARNING: externs should be avoided in .c files #644: FILE:
arch/x86/kernel/acpi/realmode/wakemain.c:4:
+extern volatile structwakeup_headerwakeup_header;ERROR: need a space before the open parenthesis '(' #710: FILE:
arch/x86/kernel/acpi/realmode/wakemain.c:70:
+ while(1);WARNING: externs should be avoided in .c files
#968: FILE:arch/x86/kernel/acpi/sleep.c:21:
+extern charwakeup_code_start,wakeup_code_end;WARNING: externs should be avoided in .c files
#970: FILE:arch/x86/kernel/acpi/sleep.c:23:
+extern unsigned longsetup_trampoline(void);WARNING: externs should be avoided in .c files
#971: FILE:arch/x86/kernel/acpi/sleep.c:24:
+extern voidwakeup_long64(void);WARNING: externs should be avoided in .c files
#973: FILE:arch/x86/kernel/acpi/sleep.c:26:
+extern unsigned longsaved_video_mode;WARNING: externs should be avoided in .c files
#974: FILE:arch/x86/kernel/acpi/sleep.c:27:
+extern longsaved_magic;WARNING: Use of volatile is usually wrong: see
Documentation/volatile-considered-harmful.txt#975: FILE:arch/x86/kernel/acpi/sleep.c:28:
+extern volatile unsigned longinit_rsp;WARNING: externs should be avoided in .c files
#975: FILE:arch/x86/kernel/acpi/sleep.c:28:
+extern volatile unsigned longinit_rsp;WARNING: externs should be avoided in .c files
#976: FILE:arch/x86/kernel/acpi/sleep.c:29:
+extern void (*initial_code)(void);WARNING: externs should be avoided in .c files
#978: FILE:arch/x86/kernel/acpi/sleep.c:31:
+extern intwakeup_pmode_return;WARNING: externs should be avoided in .c files
#979: FILE:arch/x86/kernel/acpi/sleep.c:32:
+extern char swsusp_pg_dir[PAGE_SIZE];WARNING: externs should be avoided in .c files
#984: FILE:arch/x86/kernel/acpi/sleep.c:37:
+extern unsigned longFASTCALL(acpi_copy_wakeup_routine(unsigned long));
Quoted 5 lines
total: 2 errors, 13 warnings, 1615 lines checked
/home/lenb/Documents/wakeup.patchhas style problems, please review. If any of these errors are false positives report them to the maintainer, see
CHECKPATCH inMAINTAINERS.
Ok, below is the version that survives checkpatch.pl, compiles on x86-32 and has been successfully tested on 32-bit and 64-bit systems.
Thanks,
Rafael
---
From: Pavel Machek <[email protected]>
Move wakeup code to .c, so that video mode setting code can be shared between boot and wakeup. Remove nasty assembly code in 64-bit case by re-using trampoline code. Stack setup was fixed to clear high 16bits of %esp, maybe that fixes some machines.
.c code sharing and morse code was done H. Peter Anvin, Sam Ravnborg reviewed kbuild related stuff, and it seems okay to him. Rafael did some cleanups.
[rjw: Added sleep.h and made the patch stop breaking compilation on x86-32]
--- arch/x86/boot/Makefile | 2 arch/x86/boot/boot.h | 5 arch/x86/boot/video-bios.c | 6 arch/x86/boot/video-mode.c | 173 ++++++++++++++++ arch/x86/boot/video-vesa.c | 8 arch/x86/boot/video-vga.c | 12 - arch/x86/boot/video.c | 157 -------------- arch/x86/kernel/acpi/Makefile | 9 arch/x86/kernel/acpi/realmode/Makefile | 58 +++++ arch/x86/kernel/acpi/realmode/copy.S | 1 arch/x86/kernel/acpi/realmode/video-bios.c | 1 arch/x86/kernel/acpi/realmode/video-mode.c | 1 arch/x86/kernel/acpi/realmode/video-vesa.c | 1 arch/x86/kernel/acpi/realmode/video-vga.c | 1 arch/x86/kernel/acpi/realmode/wakemain.c | 81 +++++++ arch/x86/kernel/acpi/realmode/wakeup.S | 115 ++++++++++ arch/x86/kernel/acpi/realmode/wakeup.h | 36 +++ arch/x86/kernel/acpi/realmode/wakeup.lds.S | 61 +++++ arch/x86/kernel/acpi/sleep.c | 72 +++++- arch/x86/kernel/acpi/sleep.h | 17 + arch/x86/kernel/acpi/wakeup_32.S | 245 +--------------------- arch/x86/kernel/acpi/wakeup_64.S | 313 ----------------------------- arch/x86/kernel/acpi/wakeup_rm.S | 10 arch/x86/kernel/head_64.S | 4 arch/x86/kernel/setup_32.c | 4 arch/x86/kernel/smpboot_64.c | 5 26 files changed, 689 insertions(+), 709 deletions(-)
arch/x86/boot/Makefile +1 -1
@@ -30,7 +30,7 @@ subdir- := compressed setup-y += a20.o cmdline.o copy.o cpu.o cpucheck.o edd.o setup-y += header.o main.o mca.o memory.o pm.o pmjump.o -setup-y += printf.o string.o tty.o video.o version.o +setup-y += printf.o string.o tty.o video.o video-mode.o version.o setup-$(CONFIG_X86_APM_BOOT) += apm.o setup-$(CONFIG_X86_VOYAGER) += voyager.o
arch/x86/boot/boot.h +5 -0
@@ -286,6 +286,11 @@ int getchar_timeout(void);/* video.c */ void set_video (void ); +/* video-mode.c */ +int set_mode (u16 mode); +int mode_defined (u16 mode); +void probe_cards (int unsafe); +/* video-vesa.c */ void vesa_store_edid (void );
arch/x86/boot/video-bios.c +6 -0
@@ -50,6 +50,7 @@ static int set_bios_mode(u8 mode)if (new_mode == mode)return 0 ;/* Mode change OK */ +#ifndef _WAKEUPif (new_mode != boot_params.screen_info.orig_video_mode) {/* Mode setting failed, but we didn't end up where we started. That's bad. Try to revert to the original
@@ -59,13 +60,18 @@ static int set_bios_mode(u8 mode) : "+a" (ax) : : "ebx", "ecx", "edx", "esi", "edi"); } +#endif return -1 ; }static int bios_probe (void ) {u8 mode; +#ifdef _WAKEUP +u8 saved_mode =0x03 ; +#else u8 saved_mode = boot_params.screen_info.orig_video_mode; +#endif u16 crtc;struct mode_info *mi;int nmodes =0 ;
arch/x86/boot/video-mode.c new file +173 -0
173 lines not on this page · raw message
arch/x86/boot/video-vesa.c +8 -0
@@ -24,7 +24,11 @@ static struct vesa_mode_info vminfo;__videocard video_vesa; +#ifndef _WAKEUPstatic void vesa_store_mode_params_graphics (void ); +#else /* _WAKEUP */ +static inline void vesa_store_mode_params_graphics (void ) {} +#endif /* _WAKEUP */ static int vesa_probe (void ) {
@@ -167,6 +171,8 @@ static int vesa_set_mode(struct mode_inf } +#ifndef _WAKEUP +/* Switch DAC to 8-bit mode */ static void vesa_dac_set_8bits (void ) {
@@ -290,6 +296,8 @@ void vesa_store_edid(void)#endif /* CONFIG_FIRMWARE_EDID */ } +#endif /* not _WAKEUP */ +__videocard video_vesa = { .card_name ="VESA" ,
arch/x86/boot/video-vga.c +10 -2
@@ -210,6 +210,8 @@ static int vga_set_mode(struct mode_info*/ static int vga_probe (void ) { +u16 ega_bx; +static const char *card_name[] = {"CGA/MDA/HGC" ,"EGA" ,"VGA" };
@@ -226,12 +228,16 @@ static int vga_probe(void)u8 vga_flag; asm(INT10 - : "=b" (boot_params.screen_info.orig_video_ega_bx) + : "=b" (ega_bx) : "a" (0x1200), "b" (0x10) /* Check EGA/VGA */ : "ecx", "edx", "esi", "edi"); +#ifndef _WAKEUP + boot_params.screen_info.orig_video_ega_bx = ega_bx; +#endif +/* If we have MDA/CGA/HGC then BL will be unchanged at 0x10 */ -if ((u8 )boot_params.screen_info.orig_video_ega_bx !=0x10 ) { +if ((u8 )ega_bx !=0x10 ) {/* EGA/VGA */ asm(INT10 : "=a" (vga_flag)
@@ -240,7 +246,9 @@ static int vga_probe(void)if (vga_flag ==0x1a ) { adapter =ADAPTER_VGA ; +#ifndef _WAKEUP boot_params.screen_info.orig_video_isVGA =1 ; +#endif }else { adapter =ADAPTER_EGA ; }
arch/x86/boot/video.c +1 -156
175 lines not on this page · raw message
arch/x86/kernel/acpi/Makefile +8 -1
@@ -1,7 +1,14 @@ +subdir- := realmode + obj-$(CONFIG_ACPI) += boot.o -obj-$(CONFIG_ACPI_SLEEP) += sleep.o wakeup_$(BITS).o +obj-$(CONFIG_ACPI_SLEEP) += sleep.o wakeup_rm.o wakeup_$(BITS).o ifneq ($(CONFIG_ACPI_PROCESSOR),) obj-y += cstate.o processor.o endif +$(obj)/wakeup_rm.o: $(obj)/realmode/wakeup.bin + +$(obj)/realmode/wakeup.bin: FORCE + $(Q)$(MAKE) $(build)=$(obj)/realmode $@ +
arch/x86/kernel/acpi/realmode/Makefile new file +58 -0
58 lines not on this page · raw message
arch/x86/kernel/acpi/realmode/copy.S new file +1 -0
@@ -0,0 +1 @@ +#include "../../../boot/copy.S"
arch/x86/kernel/acpi/realmode/video-bios.c new file +1 -0
@@ -0,0 +1 @@ +#include "../../../boot/video-bios.c"
arch/x86/kernel/acpi/realmode/video-mode.c new file +1 -0
@@ -0,0 +1 @@ +#include "../../../boot/video-mode.c"
arch/x86/kernel/acpi/realmode/video-vesa.c new file +1 -0
@@ -0,0 +1 @@ +#include "../../../boot/video-vesa.c"
arch/x86/kernel/acpi/realmode/video-vga.c new file +1 -0
@@ -0,0 +1 @@ +#include "../../../boot/video-vga.c"
arch/x86/kernel/acpi/realmode/wakemain.c new file +81 -0
81 lines not on this page · raw message
arch/x86/kernel/acpi/realmode/wakeup.S new file +115 -0
115 lines not on this page · raw message
arch/x86/kernel/acpi/realmode/wakeup.h new file +36 -0
@@ -0,0 +1,36 @@ +/* +* Definitions for the wakeup data structure at the head of the +* wakeup code. +*/ + +#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 */ +struct wakeup_header { +u16 video_mode;/* Video mode number */ +u16 _jmp1;/* ljmpl opcode, 32-bit only */ +u32 pmode_entry;/* Protected mode resume point, 32-bit only */ +u16 _jmp2;/* CS value, 32-bit only */ +u32 pmode_cr0;/* Protected mode cr0 */ +u32 pmode_cr3;/* Protected mode cr3 */ +u32 pmode_cr4;/* Protected mode cr4 */ +u32 pmode_efer_low;/* Protected mode EFER */ +u32 pmode_efer_high; +u64 pmode_gdt; +u32 realmode_flags; +u32 real_magic; +u16 trampoline_segment;/* segment with trampoline code, 64-bit only */ +u32 signature;/* To check we have correct structure */ +} __attribute__((__packed__ )); + +extern struct wakeup_header wakeup_header; +#endif + +#define HEADER_OFFSET 0x3f00 +#define WAKEUP_SIZE 0x4000 + +#endif /* ARCH_X86_KERNEL_ACPI_RM_WAKEUP_H */
arch/x86/kernel/acpi/realmode/wakeup.lds.S new file +61 -0
61 lines not on this page · raw message
arch/x86/kernel/acpi/sleep.c +60 -12
104 lines not on this page · raw message
arch/x86/kernel/acpi/wakeup_32.S +19 -226
286 lines not on this page · raw message
arch/x86/kernel/acpi/wakeup_64.S +9 -304
337 lines not on this page · raw message
arch/x86/kernel/acpi/wakeup_rm.S new file +10 -0
@@ -0,0 +1,10 @@ +/* + * Wrapper script for the realmode binary as a transport object + * before copying to low memory. + */ + .section ".rodata","a" + .globl wakeup_code_start, wakeup_code_end +wakeup_code_start: + .incbin "arch/x86/kernel/acpi/realmode/wakeup.bin" +wakeup_code_end: + .size wakeup_code_start, .-wakeup_code_start
arch/x86/kernel/head_64.S +0 -4
@@ -127,10 +127,6 @@ ident_complete: addq %rbp, trampoline_level4_pgt + 0(%rip) addq %rbp, trampoline_level4_pgt + (511*8)(%rip) #endif -#ifdef CONFIG_ACPI_SLEEP - addq %rbp, wakeup_level4_pgt + 0(%rip) - addq %rbp, wakeup_level4_pgt + (511*8)(%rip) -#endif /* Due to ENTRY(), sometimes the empty space gets filled with * zeros. Better take a jmp than relying on empty space being
arch/x86/kernel/setup_32.c +2 -2
@@ -190,7 +190,7 @@ EXPORT_SYMBOL(ist_info);extern void early_cpu_init (void );extern int root_mountflags; -unsigned long saved_videomode; +unsigned long saved_video_mode;#define RAMDISK_IMAGE_START_MASK 0x07FF#define RAMDISK_PROMPT_FLAG 0x8000
@@ -717,7 +717,7 @@ void __init setup_arch(char **cmdline_p) edid_info = boot_params.edid_info; apm_info.bios = boot_params.apm_bios_info; ist_info = boot_params.ist_info; - saved_videomode = boot_params.hdr.vid_mode; + saved_video_mode = boot_params.hdr.vid_mode;if ( boot_params.sys_desc_table.length !=0 ) {set_mca_bus (boot_params.sys_desc_table.table[3 ] &0x2 ); machine_id = boot_params.sys_desc_table.table[0 ];
arch/x86/kernel/smpboot_64.c +4 -1
@@ -132,7 +132,7 @@ struct task_struct *idle_thread_array[NR* has made sure it's suitably aligned. */ -static unsigned long __cpuinit setup_trampoline (void ) +unsigned long __cpuinit setup_trampoline (void ) {void *tramp =__va (SMP_TRAMPOLINE_BASE );memcpy (tramp, trampoline_data, trampoline_end - trampoline_data);
@@ -649,6 +649,9 @@ do_rest: *((volatile unsigned short *)phys_to_virt (0x467 )) = start_rip &0xf ;Dprintk ("3.\n" ); +/* Trampoline assumes it is at beggining of segment */ +BUG_ON (start_rip &0xf ); +/* * Be paranoid about clearing APIC errors. */
arch/x86/kernel/acpi/sleep.h new file +17 -0
@@ -0,0 +1,17 @@ +/* +* Variables and functions used by the code in sleep.c +*/ + +extern char wakeup_code_start, wakeup_code_end; + +extern unsigned long saved_video_mode; +extern long saved_magic; +extern unsigned long init_rsp; +extern void (*initial_code)(void ); + +extern int wakeup_pmode_return; +extern char swsusp_pg_dir[PAGE_SIZE ]; + +extern unsigned long acpi_copy_wakeup_routine (unsigned long ); +extern unsigned long setup_trampoline (void ); +extern void wakeup_long64 (void );
Len Brown
reviewerQuoted 2 lines · Rafael J. Wysocki
Ok, below is the version that survives checkpatch.pl, compiles on x86-32 and has been successfully tested on 32-bit and 64-bit systems.
works on my t61 in 64-bit mode too.
applied to acpi-test.
thanks,
-Len
Rafael J. Wysocki
Reviewed-by Sam RavnborgQuoted 8 lines · Len Brown
Quoted 2 lines · Rafael J. Wysocki
Ok, below is the version that survives checkpatch.pl, compiles on x86-32 and has been successfully tested on 32-bit and 64-bit systems.
works on my t61 in 64-bit mode too.
applied to acpi-test.
Below is an updated version of this patch, addressing the following problem reports related to it:
http://lkml.org/lkml/2008/2/16/178
http://lkml.org/lkml/2008/2/16/74
http://marc.info/?l=linux-acpi&m=120313725501682&w=4
Please replace the previous version with this one.
Thanks,
Rafael
---
From: Pavel Machek <[email protected]>
Move wakeup code to .c, so that video mode setting code can be shared between boot and wakeup. Remove nasty assembly code in 64-bit case by re-using trampoline code. Stack setup was fixed to clear high 16bits of %esp, maybe that fixes some machines.
.c code sharing and morse code was done H. Peter Anvin, Sam Ravnborg reviewed kbuild related stuff, and it seems okay to him. Rafael did some cleanups.
[rjw:
* Made the patch stop breaking compilation on x86-32
* Added arch/x86/kernel/acpi/sleep.h
* Got rid of compiler warnings in arch/x86/kernel/acpi/sleep.c
* Fixed 32-bit compilation on x86-64 systems
* Added include/asm-x86/trampoline.h and fixed the non-SMP compilation on 64-bit x86]
--- arch/x86/Kconfig | 2 arch/x86/boot/Makefile | 2 arch/x86/boot/boot.h | 5 arch/x86/boot/video-bios.c | 6 arch/x86/boot/video-mode.c | 173 ++++++++++++++++ arch/x86/boot/video-vesa.c | 8 arch/x86/boot/video-vga.c | 12 - arch/x86/boot/video.c | 157 -------------- arch/x86/kernel/acpi/Makefile | 9 arch/x86/kernel/acpi/realmode/Makefile | 57 +++++ arch/x86/kernel/acpi/realmode/copy.S | 1 arch/x86/kernel/acpi/realmode/video-bios.c | 1 arch/x86/kernel/acpi/realmode/video-mode.c | 1 arch/x86/kernel/acpi/realmode/video-vesa.c | 1 arch/x86/kernel/acpi/realmode/video-vga.c | 1 arch/x86/kernel/acpi/realmode/wakemain.c | 81 +++++++ arch/x86/kernel/acpi/realmode/wakeup.S | 113 ++++++++++ arch/x86/kernel/acpi/realmode/wakeup.h | 36 +++ arch/x86/kernel/acpi/realmode/wakeup.lds.S | 61 +++++ arch/x86/kernel/acpi/sleep.c | 73 +++++- arch/x86/kernel/acpi/sleep.h | 18 + arch/x86/kernel/acpi/wakeup_32.S | 245 +--------------------- arch/x86/kernel/acpi/wakeup_64.S | 313 ----------------------------- arch/x86/kernel/acpi/wakeup_rm.S | 10 arch/x86/kernel/e820_64.c | 5 arch/x86/kernel/head_64.S | 4 arch/x86/kernel/setup_32.c | 4 arch/x86/kernel/setup_64.c | 16 + arch/x86/kernel/smpboot_64.c | 26 -- include/asm-x86/smp_64.h | 2 include/asm-x86/trampoline.h | 18 + 31 files changed, 726 insertions(+), 735 deletions(-)
arch/x86/boot/Makefile +1 -1
@@ -30,7 +30,7 @@ subdir- := compressed setup-y += a20.o cmdline.o copy.o cpu.o cpucheck.o edd.o setup-y += header.o main.o mca.o memory.o pm.o pmjump.o -setup-y += printf.o string.o tty.o video.o version.o +setup-y += printf.o string.o tty.o video.o video-mode.o version.o setup-$(CONFIG_X86_APM_BOOT) += apm.o setup-$(CONFIG_X86_VOYAGER) += voyager.o
arch/x86/boot/boot.h +5 -0
@@ -286,6 +286,11 @@ int getchar_timeout(void);/* video.c */ void set_video (void ); +/* video-mode.c */ +int set_mode (u16 mode); +int mode_defined (u16 mode); +void probe_cards (int unsafe); +/* video-vesa.c */ void vesa_store_edid (void );
arch/x86/boot/video-bios.c +6 -0
@@ -50,6 +50,7 @@ static int set_bios_mode(u8 mode)if (new_mode == mode)return 0 ;/* Mode change OK */ +#ifndef _WAKEUPif (new_mode != boot_params.screen_info.orig_video_mode) {/* Mode setting failed, but we didn't end up where we started. That's bad. Try to revert to the original
@@ -59,13 +60,18 @@ static int set_bios_mode(u8 mode) : "+a" (ax) : : "ebx", "ecx", "edx", "esi", "edi"); } +#endif return -1 ; }static int bios_probe (void ) {u8 mode; +#ifdef _WAKEUP +u8 saved_mode =0x03 ; +#else u8 saved_mode = boot_params.screen_info.orig_video_mode; +#endif u16 crtc;struct mode_info *mi;int nmodes =0 ;
arch/x86/boot/video-mode.c new file +173 -0
173 lines not on this page · raw message
arch/x86/boot/video-vesa.c +8 -0
@@ -24,7 +24,11 @@ static struct vesa_mode_info vminfo;__videocard video_vesa; +#ifndef _WAKEUPstatic void vesa_store_mode_params_graphics (void ); +#else /* _WAKEUP */ +static inline void vesa_store_mode_params_graphics (void ) {} +#endif /* _WAKEUP */ static int vesa_probe (void ) {
@@ -167,6 +171,8 @@ static int vesa_set_mode(struct mode_inf } +#ifndef _WAKEUP +/* Switch DAC to 8-bit mode */ static void vesa_dac_set_8bits (void ) {
@@ -290,6 +296,8 @@ void vesa_store_edid(void)#endif /* CONFIG_FIRMWARE_EDID */ } +#endif /* not _WAKEUP */ +__videocard video_vesa = { .card_name ="VESA" ,
arch/x86/boot/video-vga.c +10 -2
@@ -210,6 +210,8 @@ static int vga_set_mode(struct mode_info*/ static int vga_probe (void ) { +u16 ega_bx; +static const char *card_name[] = {"CGA/MDA/HGC" ,"EGA" ,"VGA" };
@@ -226,12 +228,16 @@ static int vga_probe(void)u8 vga_flag; asm(INT10 - : "=b" (boot_params.screen_info.orig_video_ega_bx) + : "=b" (ega_bx) : "a" (0x1200), "b" (0x10) /* Check EGA/VGA */ : "ecx", "edx", "esi", "edi"); +#ifndef _WAKEUP + boot_params.screen_info.orig_video_ega_bx = ega_bx; +#endif +/* If we have MDA/CGA/HGC then BL will be unchanged at 0x10 */ -if ((u8 )boot_params.screen_info.orig_video_ega_bx !=0x10 ) { +if ((u8 )ega_bx !=0x10 ) {/* EGA/VGA */ asm(INT10 : "=a" (vga_flag)
@@ -240,7 +246,9 @@ static int vga_probe(void)if (vga_flag ==0x1a ) { adapter =ADAPTER_VGA ; +#ifndef _WAKEUP boot_params.screen_info.orig_video_isVGA =1 ; +#endif }else { adapter =ADAPTER_EGA ; }
arch/x86/boot/video.c +1 -156
175 lines not on this page · raw message
arch/x86/kernel/acpi/Makefile +8 -1
@@ -1,7 +1,14 @@ +subdir- := realmode + obj-$(CONFIG_ACPI) += boot.o -obj-$(CONFIG_ACPI_SLEEP) += sleep.o wakeup_$(BITS).o +obj-$(CONFIG_ACPI_SLEEP) += sleep.o wakeup_rm.o wakeup_$(BITS).o ifneq ($(CONFIG_ACPI_PROCESSOR),) obj-y += cstate.o processor.o endif +$(obj)/wakeup_rm.o: $(obj)/realmode/wakeup.bin + +$(obj)/realmode/wakeup.bin: FORCE + $(Q)$(MAKE) $(build)=$(obj)/realmode $@ +
arch/x86/kernel/acpi/realmode/Makefile new file +57 -0
57 lines not on this page · raw message
arch/x86/kernel/acpi/realmode/copy.S new file +1 -0
@@ -0,0 +1 @@ +#include "../../../boot/copy.S"
arch/x86/kernel/acpi/realmode/video-bios.c new file +1 -0
@@ -0,0 +1 @@ +#include "../../../boot/video-bios.c"
arch/x86/kernel/acpi/realmode/video-mode.c new file +1 -0
@@ -0,0 +1 @@ +#include "../../../boot/video-mode.c"
arch/x86/kernel/acpi/realmode/video-vesa.c new file +1 -0
@@ -0,0 +1 @@ +#include "../../../boot/video-vesa.c"
arch/x86/kernel/acpi/realmode/video-vga.c new file +1 -0
@@ -0,0 +1 @@ +#include "../../../boot/video-vga.c"
arch/x86/kernel/acpi/realmode/wakemain.c new file +81 -0
81 lines not on this page · raw message
arch/x86/kernel/acpi/realmode/wakeup.S new file +113 -0
113 lines not on this page · raw message
arch/x86/kernel/acpi/realmode/wakeup.h new file +36 -0
@@ -0,0 +1,36 @@ +/* +* Definitions for the wakeup data structure at the head of the +* wakeup code. +*/ + +#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 */ +struct wakeup_header { +u16 video_mode;/* Video mode number */ +u16 _jmp1;/* ljmpl opcode, 32-bit only */ +u32 pmode_entry;/* Protected mode resume point, 32-bit only */ +u16 _jmp2;/* CS value, 32-bit only */ +u32 pmode_cr0;/* Protected mode cr0 */ +u32 pmode_cr3;/* Protected mode cr3 */ +u32 pmode_cr4;/* Protected mode cr4 */ +u32 pmode_efer_low;/* Protected mode EFER */ +u32 pmode_efer_high; +u64 pmode_gdt; +u32 realmode_flags; +u32 real_magic; +u16 trampoline_segment;/* segment with trampoline code, 64-bit only */ +u32 signature;/* To check we have correct structure */ +} __attribute__((__packed__ )); + +extern struct wakeup_header wakeup_header; +#endif + +#define HEADER_OFFSET 0x3f00 +#define WAKEUP_SIZE 0x4000 + +#endif /* ARCH_X86_KERNEL_ACPI_RM_WAKEUP_H */
arch/x86/kernel/acpi/realmode/wakeup.lds.S new file +61 -0
61 lines not on this page · raw message
arch/x86/kernel/acpi/sleep.c +60 -13
105 lines not on this page · raw message
arch/x86/kernel/acpi/wakeup_32.S +19 -226
286 lines not on this page · raw message
arch/x86/kernel/acpi/wakeup_64.S +9 -304
337 lines not on this page · raw message
arch/x86/kernel/acpi/wakeup_rm.S new file +10 -0
@@ -0,0 +1,10 @@ +/* + * Wrapper script for the realmode binary as a transport object + * before copying to low memory. + */ + .section ".rodata","a" + .globl wakeup_code_start, wakeup_code_end +wakeup_code_start: + .incbin "arch/x86/kernel/acpi/realmode/wakeup.bin" +wakeup_code_end: + .size wakeup_code_start, .-wakeup_code_start
arch/x86/kernel/head_64.S +0 -4
@@ -127,10 +127,6 @@ ident_complete: addq %rbp, trampoline_level4_pgt + 0(%rip) addq %rbp, trampoline_level4_pgt + (511*8)(%rip) #endif -#ifdef CONFIG_ACPI_SLEEP - addq %rbp, wakeup_level4_pgt + 0(%rip) - addq %rbp, wakeup_level4_pgt + (511*8)(%rip) -#endif /* Due to ENTRY(), sometimes the empty space gets filled with * zeros. Better take a jmp than relying on empty space being
arch/x86/kernel/setup_32.c +2 -2
@@ -190,7 +190,7 @@ EXPORT_SYMBOL(ist_info);extern void early_cpu_init (void );extern int root_mountflags; -unsigned long saved_videomode; +unsigned long saved_video_mode;#define RAMDISK_IMAGE_START_MASK 0x07FF#define RAMDISK_PROMPT_FLAG 0x8000
@@ -717,7 +717,7 @@ void __init setup_arch(char **cmdline_p) edid_info = boot_params.edid_info; apm_info.bios = boot_params.apm_bios_info; ist_info = boot_params.ist_info; - saved_videomode = boot_params.hdr.vid_mode; + saved_video_mode = boot_params.hdr.vid_mode;if ( boot_params.sys_desc_table.length !=0 ) {set_mca_bus (boot_params.sys_desc_table.table[3 ] &0x2 ); machine_id = boot_params.sys_desc_table.table[0 ];
arch/x86/kernel/smpboot_64.c +5 -21
@@ -59,6 +59,7 @@#include <asm/irq.h> #include <asm/hw_irq.h> #include <asm/numa.h> +#include <asm/trampoline.h> /* Number of siblings per CPU package */ int smp_num_siblings =1 ;
@@ -96,13 +97,6 @@ EXPORT_PER_CPU_SYMBOL(cpu_sibling_map);DEFINE_PER_CPU (cpumask_t, cpu_core_map);EXPORT_PER_CPU_SYMBOL (cpu_core_map); -/* -* Trampoline 80x86 program as an array. -*/ - -extern const unsigned char trampoline_data[]; -extern const unsigned char trampoline_end[]; -/* State of each CPU */ DEFINE_PER_CPU(int, cpu_state) = { 0 };
@@ -127,19 +121,6 @@ struct task_struct *idle_thread_array[NR/* -* Currently trivial. Write the real->protected mode -* bootstrap into the page concerned. The caller -* has made sure it's suitably aligned. -*/ - -static unsigned long __cpuinit setup_trampoline (void ) -{ -void *tramp =__va (SMP_TRAMPOLINE_BASE ); -memcpy (tramp, trampoline_data, trampoline_end - trampoline_data); -return virt_to_phys (tramp); -} - -/* * The bootstrap kernel entry code has set these up. Save them for * a given CPU */
@@ -649,6 +630,9 @@ do_rest: *((volatile unsigned short *)phys_to_virt (0x467 )) = start_rip &0xf ;Dprintk ("3.\n" ); +/* Trampoline assumes it is at beggining of segment */ +BUG_ON (start_rip &0xf ); +/* * Be paranoid about clearing APIC errors. */
@@ -687,7 +671,7 @@ do_rest:Dprintk ("CPU has booted.\n" ); }else { boot_error =1 ; -if (*((volatile unsigned char *)phys_to_virt (SMP_TRAMPOLINE_BASE )) +if (*((unsigned char *)phys_to_virt (TRAMPOLINE_BASE )) ==0xA5 )/* trampoline started but...? */ printk ("Stuck ??\n" );
arch/x86/kernel/acpi/sleep.h new file +18 -0
@@ -0,0 +1,18 @@ +/* +* Variables and functions used by the code in sleep.c +*/ + +#include <asm/trampoline.h> + +extern char wakeup_code_start, wakeup_code_end; + +extern unsigned long saved_video_mode; +extern long saved_magic; +extern unsigned long init_rsp; +extern void (*initial_code)(void ); + +extern int wakeup_pmode_return; +extern char swsusp_pg_dir[PAGE_SIZE ]; + +extern unsigned long acpi_copy_wakeup_routine (unsigned long ); +extern void wakeup_long64 (void );
arch/x86/Kconfig +1 -1
@@ -183,7 +183,7 @@ config X86_BIOS_REBOOT config X86_TRAMPOLINE bool - depends on X86_SMP || (X86_VOYAGER && SMP) + depends on X86_SMP || (X86_VOYAGER && SMP) || (64BIT && ACPI_SLEEP) default y config KTIME_SCALAR
arch/x86/kernel/e820_64.c +3 -2
@@ -27,6 +27,7 @@#include <asm/setup.h> #include <asm/sections.h> #include <asm/kdebug.h> +#include <asm/trampoline.h> struct e820map e820;
@@ -58,8 +59,8 @@ struct early_res { };static struct early_res early_res[MAX_EARLY_RES ]__initdata = { {0 ,PAGE_SIZE ,"BIOS data page" },/* BIOS data page */ -#ifdef CONFIG_SMP - {SMP_TRAMPOLINE_BASE ,SMP_TRAMPOLINE_BASE +2 *PAGE_SIZE ,"SMP_TRAMPOLINE" }, +#ifdef CONFIG_X86_TRAMPOLINE + {TRAMPOLINE_BASE ,TRAMPOLINE_BASE +2 *PAGE_SIZE ,"TRAMPOLINE" }, #endif {} };
arch/x86/kernel/setup_64.c +16 -0
@@ -66,6 +66,7 @@#include <asm/mce.h> #include <asm/ds.h> #include <asm/topology.h> +#include <asm/trampoline.h> #ifdef CONFIG_PARAVIRT #include <asm/paravirt.h>
@@ -1184,3 +1185,18 @@ const struct seq_operations cpuinfo_op = .stop = c_stop, .show = show_cpuinfo, }; + +#ifdef CONFIG_X86_TRAMPOLINE +/* +* Currently trivial. Write the real->protected mode +* bootstrap into the page concerned. The caller +* has made sure it's suitably aligned. +*/ + +unsigned long setup_trampoline (void ) +{ +void *tramp =__va (TRAMPOLINE_BASE ); +memcpy (tramp, trampoline_data, trampoline_end - trampoline_data); +return virt_to_phys (tramp); +} +#endif /* CONFIG_X86_TRAMPOLINE */
include/asm-x86/smp_64.h +0 -2
@@ -47,8 +47,6 @@ static inline int cpu_present_to_apicid(#ifdef CONFIG_SMP -#define SMP_TRAMPOLINE_BASE 0x6000 -extern int __cpu_disable (void );extern void __cpu_die (unsigned int cpu);extern void prefill_possible_map (void );
include/asm-x86/trampoline.h new file +18 -0
@@ -0,0 +1,18 @@ +#ifndef __TRAMPOLINE_HEADER +#define __TRAMPOLINE_HEADER + +#ifndef __ASSEMBLY__ + +#define TRAMPOLINE_BASE 0x6000 + +/* +* Trampoline 80x86 program as an array. +*/ +extern const unsigned char trampoline_data[]; +extern const unsigned char trampoline_end[]; + +extern unsigned long setup_trampoline (void ); + +#endif /* __ASSEMBLY__ */ + +#endif /* __TRAMPOLINE_HEADER */
Quoted 10 lines · Rafael J. Wysocki
Quoted 8 lines · Len Brown
Quoted 2 lines · Rafael J. Wysocki
Ok, below is the version that survives checkpatch.pl, compiles on x86-32 and has been successfully tested on 32-bit and 64-bit systems.
works on my t61 in 64-bit mode too.
applied to acpi-test.
Quoted 7 lines
Below is an updated version of this patch, addressing the following problem reports related to it:
http://lkml.org/lkml/2008/2/16/178
http://lkml.org/lkml/2008/2/16/74
http://marc.info/?l=linux-acpi&m=120313725501682&w=4Please replace the previous version with this one.
Please disregard it, I'm going to send an updated version in a while.
Thanks,
Rafael
Len Brown
reviewerQuoted 2 lines · Rafael J. Wysocki
Ok, below is the version that survives checkpatch.pl, compiles on x86-32 and has been successfully tested on 32-bit and 64-bit systems.
works on my t61 in 64-bit mode too.
applied to acpi-test.
thanks,
-Len