All of lore.kernel.org
 help / color / mirror / Atom feed
From: matthieu castet <castet.matthieu@free.fr>
To: Pavel Machek <pavel@ucw.cz>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>,
	linux-acpi@vger.kernel.org,
	pm list <linux-pm@lists.linux-foundation.org>
Subject: Re: suspend to ram problem
Date: Sun, 03 Feb 2008 19:40:40 +0100	[thread overview]
Message-ID: <47A60AA8.8050407@free.fr> (raw)
In-Reply-To: <20080203181855.GB1629@elf.ucw.cz>

[-- Attachment #1: Type: text/plain, Size: 760 bytes --]

Pavel Machek wrote:
> On Sun 2008-02-03 18:39:01, Rafael J. Wysocki wrote:

>>> So the hang seems located in wakeup_start.
>> Hm.  Can you add unconditional BEEP after "jne bogus_real_magic" in
>> arch/x86/kernel/acpi/wakeup.S and see if it beeps?
I rewrite the beep tracer to generate small beep (I should clean the 
patch and try to submit it), and I only hear 2 beep.

So it crash when clearing the flags.

> 
> Hmm, maybe I know where problem could be. Try
> 
>         movl     $(wakeup_stack - wakeup_code), %esp              # Private stack is needed for ASUS bo\
> 
> instead of existing stack setup. That helped on one of my test-boxes
Thanks, I will try that.
Because clearing the flags imply pop/push in the stack it could be the 
problem

Matthieu

[-- Attachment #2: beep_tracer.diff --]
[-- Type: text/x-patch, Size: 3430 bytes --]

--- /home/mat/tmp/wakeup.S	2008-02-03 19:20:26.000000000 +0100
+++ arch/i386/kernel/acpi/wakeup.S	2008-02-03 19:30:20.000000000 +0100
@@ -13,20 +13,47 @@
 # cs = 0x1234, eip = 0x05
 # 
 
+/* one ISA cycle @8Mhz */
+#define PAUSE outb %al, $0x80
+#define WAIT_100MS \
+	movl $800000, %eax; \
+	2: \
+	PAUSE; \
+	dec %eax; \
+	jne 2b
+
+/* What's the PIT rate */
+#define COUNT 0xf89
 #define BEEP \
-	inb	$97, %al; 	\
-	outb	%al, $0x80; 	\
-	movb	$3, %al; 	\
-	outb	%al, $97; 	\
-	outb	%al, $0x80; 	\
-	movb	$-74, %al; 	\
-	outb	%al, $67; 	\
-	outb	%al, $0x80; 	\
-	movb	$-119, %al; 	\
-	outb	%al, $66; 	\
-	outb	%al, $0x80; 	\
-	movb	$15, %al; 	\
-	outb	%al, $66;
+	/* enable counter 2 */ \
+	inb		$0x61, %al; 	\
+	PAUSE; 	\
+	orb	$3, %al; \
+	outb	%al, $0x61; 	\
+	PAUSE; 	\
+	/* set command for counter 2, 2 byte write */ \
+	movb	$0xB6, %al; 	\
+	outb	%al, $0x43; 	\
+	PAUSE; 	\
+	/* select desired HZ */ \
+	movb	$(COUNT & 0xff), %al; \
+	outb	%al, $0x42; 	\
+	PAUSE; 	\
+	movb	$(COUNT >> 8), %al; 	\
+	outb	%al, $0x42; \
+	WAIT_100MS; \
+	/* disable counter 2 */ \
+	inb		$0x61, %al; 	\
+	PAUSE; 	\
+	andb	$0xFC, %al; \
+	outb	%al, $0x61; \
+	WAIT_100MS
+
+#define CBEEP \
+	testl   $4, realmode_flags - wakeup_code; \
+	jz      1f; \
+	BEEP; \
+1:
 
 ALIGN
 	.align	4096
@@ -37,7 +64,8 @@
 
  	movw	$0xb800, %ax
 	movw	%ax,%fs
-	movw	$0x0e00 + 'L', %fs:(0x10)
+	#movw	$0x0e00 + 'L', %fs:(0x10)
+	CBEEP
 
 	cli
 	cld
@@ -47,19 +75,18 @@
 	movw	%ax, %ds					# Make ds:0 point to wakeup_start
 	movw	%ax, %ss
 
-	testl   $4, realmode_flags - wakeup_code
-	jz      1f
-	BEEP
-1:
 	mov	$(wakeup_stack - wakeup_code), %sp		# Private stack is needed for ASUS board
-	movw	$0x0e00 + 'S', %fs:(0x12)
+	#movw	$0x0e00 + 'S', %fs:(0x12)
+	CBEEP
 
 	pushl	$0						# Kill any dangerous flags
 	popfl
+	CBEEP
 
 	movl	real_magic - wakeup_code, %eax
 	cmpl	$0x12345678, %eax
 	jne	bogus_real_magic
+	CBEEP
 
 	testl	$1, realmode_flags - wakeup_code
 	jz	1f
@@ -79,6 +106,7 @@
 	movl	$swsusp_pg_dir-__PAGE_OFFSET, %eax
 	movl	%eax, %cr3
 
+	CBEEP
 	testl	$1, real_efer_save_restore - wakeup_code
 	jz	4f
 	# restore efer setting
@@ -87,12 +115,14 @@
 	mov     $0xc0000080, %ecx
 	wrmsr
 4:
+	CBEEP
 	# make sure %cr4 is set correctly (features, etc)
 	movl	real_save_cr4 - wakeup_code, %eax
 	movl	%eax, %cr4
 	movw	$0xb800, %ax
 	movw	%ax,%fs
-	movw	$0x0e00 + 'i', %fs:(0x12)
+	#movw	$0x0e00 + 'i', %fs:(0x12)
+	CBEEP
 	
 	# need a gdt -- use lgdtl to force 32-bit operands, in case
 	# the GDT is located past 16 megabytes.
@@ -102,15 +132,14 @@
 	movl	%eax, %cr0
 	jmp 1f
 1:
-	movw	$0x0e00 + 'n', %fs:(0x14)
+	#movw	$0x0e00 + 'n', %fs:(0x14)
+	CBEEP
 
 	movl	real_magic - wakeup_code, %eax
 	cmpl	$0x12345678, %eax
 	jne	bogus_real_magic
 
-	testl   $8, realmode_flags - wakeup_code
-	jz      1f
-	BEEP
+	CBEEP
 1:
 	ljmpl	$__KERNEL_CS, $wakeup_pmode_return
 
@@ -128,7 +157,8 @@
 real_save_efer_eax: 	.long 0
 
 bogus_real_magic:
-	movw	$0x0e00 + 'B', %fs:(0x12)
+	BEEP
+	#movw	$0x0e00 + 'B', %fs:(0x12)
 	jmp bogus_real_magic
 
 /* This code uses an extended set of video mode numbers. These include:
@@ -194,7 +224,7 @@
 	movw	%ax, %es
 	movw	%ax, %fs
 	movw	%ax, %gs
-	movw	$0x0e00 + 'u', 0xb8016
+	#movw	$0x0e00 + 'u', 0xb8016
 
 	# reload the gdt, as we need the full 32 bit address
 	lgdt	saved_gdt
@@ -218,7 +248,7 @@
 	jmp	*%eax
 
 bogus_magic:
-	movw	$0x0e00 + 'B', 0xb8018
+	#movw	$0x0e00 + 'B', 0xb8018
 	jmp	bogus_magic
 
 

  parent reply	other threads:[~2008-02-03 18:40 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-03 13:37 suspend to ram problem matthieu castet
2008-02-03 15:31 ` matthieu castet
2008-02-03 17:39   ` Rafael J. Wysocki
2008-02-03 18:18     ` Pavel Machek
2008-02-03 18:22       ` Rafael J. Wysocki
2008-02-03 18:22       ` Rafael J. Wysocki
2008-02-03 18:40       ` matthieu castet [this message]
2008-02-04  6:57         ` matthieu castet
2008-02-05 23:02           ` matthieu castet
2008-02-05 23:20             ` Rafael J. Wysocki
2008-02-06 22:40               ` matthieu castet
2008-02-06 22:40               ` matthieu castet
2008-02-06 22:43                 ` Pavel Machek
2008-02-06 23:03                   ` Rafael J. Wysocki
2008-02-06 23:03                   ` Rafael J. Wysocki
2008-02-07 20:12                     ` Cacy Rodney
2008-02-06 22:43                 ` Pavel Machek
2008-02-06 22:43                 ` Pavel Machek
2008-02-06 23:17                   ` matthieu castet
2008-02-07  9:20                     ` Pavel Machek
2008-02-07 19:49                       ` matthieu castet
2008-02-07 19:49                       ` matthieu castet
2008-02-07 20:00                         ` Rafael J. Wysocki
2008-02-07 20:00                         ` Rafael J. Wysocki
2008-02-08 22:10                           ` Pavel Machek
2008-02-08 22:10                           ` Pavel Machek
2008-02-07  9:20                     ` Pavel Machek
2008-02-06 23:17                   ` matthieu castet
2008-02-06 22:43                 ` Pavel Machek
2008-02-05 23:20             ` Rafael J. Wysocki
2008-02-07  9:23             ` Pavel Machek
2008-02-07  9:23             ` Pavel Machek
2008-02-07 18:39               ` Rafael J. Wysocki
2008-02-07 18:39               ` Rafael J. Wysocki
2008-02-05 23:02           ` matthieu castet
2008-02-04  6:57         ` matthieu castet
2008-02-03 18:40       ` matthieu castet
2008-02-03 18:18     ` Pavel Machek
2008-02-03 17:39   ` Rafael J. Wysocki
  -- strict thread matches above, loose matches on Subject: below --
2007-05-29 14:03 (अमेय) Ameya (पाळंदे) Palande
     [not found] ` <269694c00705290703x5a9cd048i78cd6c5dbff43f18-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2007-05-29 14:07   ` Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47A60AA8.8050407@free.fr \
    --to=castet.matthieu@free.fr \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=pavel@ucw.cz \
    --cc=rjw@sisk.pl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.