public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] Radeon acpi vgapost
@ 2005-08-28  1:25 Michael Marineau
  2005-08-28  1:27 ` [PATCH 1/3] Generic " Michael Marineau
                   ` (5 more replies)
  0 siblings, 6 replies; 14+ messages in thread
From: Michael Marineau @ 2005-08-28  1:25 UTC (permalink / raw)
  To: Andrew Morton, benh; +Cc: Pavel Machek, linux-kernel

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

Thses patches resume ATI radeon cards from acpi S3 suspend when using
radeonfb by reposting the video bios. This is needed to be able to use
S3 when the framebuffer is enabled.
-- 
Michael Marineau
marineam@engr.orst.edu
Oregon State University

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 256 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 1/3] Generic acpi vgapost
  2005-08-28  1:25 [PATCH 0/3] Radeon acpi vgapost Michael Marineau
@ 2005-08-28  1:27 ` Michael Marineau
  2005-08-28  8:07   ` Pavel Machek
                     ` (2 more replies)
  2005-08-28  1:31 ` [PATCH 2/3] Radeon " Michael Marineau
                   ` (4 subsequent siblings)
  5 siblings, 3 replies; 14+ messages in thread
From: Michael Marineau @ 2005-08-28  1:27 UTC (permalink / raw)
  To: Andrew Morton, benh; +Cc: Pavel Machek, linux-kernel


[-- Attachment #1.1: Type: text/plain, Size: 219 bytes --]

Generic function to post the video bios.

Based directly on the original patch by Ole Rohne.

Signed-off-by: Michael Marineau <marineam@engr.orst.edu>
-- 
Michael Marineau
marineam@engr.orst.edu
Oregon State University

[-- Attachment #1.2: acpi-vgapost.patch --]
[-- Type: text/x-patch, Size: 3466 bytes --]

Index: linux-2.6.13-rc7/arch/i386/kernel/acpi/sleep.c
===================================================================
--- linux-2.6.13-rc7.orig/arch/i386/kernel/acpi/sleep.c
+++ linux-2.6.13-rc7/arch/i386/kernel/acpi/sleep.c
@@ -5,6 +5,7 @@
  *  Copyright (C) 2001-2003 Pavel Machek <pavel@suse.cz>
  */
 
+#include <linux/module.h>
 #include <linux/acpi.h>
 #include <linux/bootmem.h>
 #include <linux/dmi.h>
@@ -56,6 +57,34 @@ void acpi_restore_state_mem (void)
 	zap_low_mappings();
 }
 
+/*
+ * acpi_vgapost
+ */
+
+extern void do_vgapost_lowlevel (unsigned long);
+
+void acpi_vgapost (unsigned long slot)
+{
+	unsigned long flags, saved_video_flags = acpi_video_flags;
+
+	acpi_video_flags = (slot & 0xffff) << 16 | 1;
+
+	/* Map low memory and copy information */
+	init_low_mapping(swapper_pg_dir, USER_PTRS_PER_PGD);
+	memcpy((void *) acpi_wakeup_address, &wakeup_start, &wakeup_end - &wakeup_start);
+	acpi_copy_wakeup_routine(acpi_wakeup_address);
+
+	/* Tunnel thru real mode */
+	local_irq_save(flags);
+	do_vgapost_lowlevel(acpi_wakeup_address);
+	local_irq_restore(flags);
+
+	/* Restore mapping etc */
+	zap_low_mappings();
+	acpi_video_flags = saved_video_flags;
+}
+EXPORT_SYMBOL (acpi_vgapost);
+
 /**
  * acpi_reserve_bootmem - do _very_ early ACPI initialisation
  *
Index: linux-2.6.13-rc7/arch/i386/kernel/acpi/wakeup.S
===================================================================
--- linux-2.6.13-rc7.orig/arch/i386/kernel/acpi/wakeup.S
+++ linux-2.6.13-rc7/arch/i386/kernel/acpi/wakeup.S
@@ -171,6 +171,32 @@ check_vesa:
 
 _setbad: jmp setbad
 
+#
+#	Real mode switch - verbatim from reboot.c
+#
+go_real:
+	movl	%cr0, %eax
+	andl	$0x00000011, %eax
+	orl	$0x60000000, %eax
+	movl	%eax, %cr0
+	movl	%eax, %cr3
+	movl	%cr0, %ebx
+	andl	$0x60000000, %ebx
+	jz	1f
+	wbinvd
+1:	andb	$0x10, %al
+	movl	%eax, %cr0
+go_real_jmp:		.byte	0xea
+go_real_jmp_off:	.word	0x0000
+go_real_jmp_seg:	.word	0x0000
+#
+# 	Real mode descriptor table
+#
+		.align	8
+go_real_desc:	.quad	0x0000000000000000
+go_real_cseg:	.quad	0x00009a000000ffff
+go_real_dseg:	.quad	0x000092000000ffff
+
 	.code32
 	ALIGN
 
@@ -310,6 +336,59 @@ ENTRY(do_suspend_lowlevel_s4bios)
 	call acpi_enter_sleep_state_s4bios
 	ret
 
+ENTRY(do_vgapost_lowlevel)
+	# Convert target offset to physical address
+	movl	%eax, %ecx
+	subl	$__PAGE_OFFSET, %ecx
+	# Fixup GDT pointer
+	movl	%ecx, %edx
+	addl	$go_real_desc - wakeup_start, %edx
+	movl	%edx, go_real_gdt + 2
+	# Fixup 16-bit CS descriptor
+	movl	%ecx, %edx
+	movw	%dx, go_real_cseg - wakeup_start + 2 (%eax)
+	shrl	$16, %edx
+	movb	%dl, go_real_cseg - wakeup_start + 4 (%eax)
+	movb	%dh, go_real_cseg - wakeup_start + 7 (%eax)
+	# Fixup 16-bit jump
+	movl	%ecx, %edx
+	shrl	$4, %edx
+	movw	%dx, go_real_jmp_seg - wakeup_start (%eax)
+	# Save state and registers
+	call	save_processor_state
+	call	save_registers
+	# Reload page table with low mapping
+	movl	$swapper_pg_dir-__PAGE_OFFSET, %eax
+	movl	%eax, %cr3
+	# Load IDTR and GDTR for real mode
+	lidt	go_real_idt
+	lgdt	go_real_gdt
+	# Load DS & al
+	movl	$0x0010, %eax
+	movl	%eax, %ss
+	movl	%eax, %ds
+	movl	%eax, %es
+	movl	%eax, %fs
+	movl	%eax, %gs
+	# Load CS
+	call	$0x0008, $(go_real - wakeup_start)
+	# Phony return code
+	call	restore_registers
+	call	restore_processor_state
+	ret
+
+	.align	4
+	.word	0
+go_real_idt:
+	.word	0x3ff
+	.long	0
+
+	.align	4
+	.word	0
+go_real_gdt:
+	.word	3*8-1
+	.long	0
+
 ALIGN
 # saved registers
 saved_gdt:	.long	0,0

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 256 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/3] Radeon acpi vgapost
  2005-08-28  1:25 [PATCH 0/3] Radeon acpi vgapost Michael Marineau
  2005-08-28  1:27 ` [PATCH 1/3] Generic " Michael Marineau
@ 2005-08-28  1:31 ` Michael Marineau
  2005-08-28  1:34 ` [PATCH 3/3] Documentation update for radeonfb Michael Marineau
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 14+ messages in thread
From: Michael Marineau @ 2005-08-28  1:31 UTC (permalink / raw)
  To: Andrew Morton, benh; +Cc: Pavel Machek, linux-kernel


[-- Attachment #1.1: Type: text/plain, Size: 213 bytes --]

Ben, do I have your blessing on this one?

Adds the video post method of resume for x86 to radeonfb to allow for
resuming after S3 acpi suspend.
-- 
Michael Marineau
marineam@engr.orst.edu
Oregon State University

[-- Attachment #1.2: radeonfb-vgapost.patch --]
[-- Type: text/x-patch, Size: 1823 bytes --]

Index: linux-2.6.13-rc7/drivers/video/aty/radeon_pm.c
===================================================================
--- linux-2.6.13-rc7.orig/drivers/video/aty/radeon_pm.c
+++ linux-2.6.13-rc7/drivers/video/aty/radeon_pm.c
@@ -2403,6 +2403,15 @@ static void radeon_reinitialize_QW(struc
 
 #endif /* CONFIG_PPC_OF */
 
+#if defined(CONFIG_ACPI) && defined(CONFIG_X86)
+extern void acpi_vgapost (unsigned long slot);
+
+static void radeon_reinitialize_vgapost(struct radeonfb_info *rinfo)
+{
+	acpi_vgapost (rinfo->pdev->devfn);
+}
+#endif
+
 static void radeon_set_suspend(struct radeonfb_info *rinfo, int suspend)
 {
 	u16 pwr_cmd;
@@ -2657,6 +2666,8 @@ int radeonfb_pci_resume(struct pci_dev *
 		 */
 		else if (rinfo->pm_mode & radeon_pm_d2)
 			radeon_set_suspend(rinfo, 0);
+		if (rinfo->pm_mode & radeon_pm_post && rinfo->reinit_func != NULL)
+			rinfo->reinit_func(rinfo);
 
 		rinfo->asleep = 0;
 	} else
@@ -2777,6 +2788,13 @@ void radeonfb_pm_init(struct radeonfb_in
 #endif
 	}
 #endif /* defined(CONFIG_PM) && defined(CONFIG_PPC_OF) */
+
+#if defined(CONFIG_ACPI) && defined(CONFIG_X86)
+	if (rinfo->is_mobility && rinfo->pm_reg) {
+		rinfo->reinit_func = radeon_reinitialize_vgapost;
+		rinfo->pm_mode |= radeon_pm_post;
+	}
+#endif
 }
 
 void radeonfb_pm_exit(struct radeonfb_info *rinfo)
Index: linux-2.6.13-rc7/drivers/video/aty/radeonfb.h
===================================================================
--- linux-2.6.13-rc7.orig/drivers/video/aty/radeonfb.h
+++ linux-2.6.13-rc7/drivers/video/aty/radeonfb.h
@@ -271,6 +271,7 @@ enum radeon_pm_mode {
 	radeon_pm_none	= 0,		/* Nothing supported */
 	radeon_pm_d2	= 0x00000001,	/* Can do D2 state */
 	radeon_pm_off	= 0x00000002,	/* Can resume from D3 cold */
+	radeon_pm_post	= 0x00000004,	/* Resume with vgapost */
 };
 
 struct radeonfb_info {

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 256 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 3/3] Documentation update for radeonfb
  2005-08-28  1:25 [PATCH 0/3] Radeon acpi vgapost Michael Marineau
  2005-08-28  1:27 ` [PATCH 1/3] Generic " Michael Marineau
  2005-08-28  1:31 ` [PATCH 2/3] Radeon " Michael Marineau
@ 2005-08-28  1:34 ` Michael Marineau
  2005-08-28  5:12 ` [PATCH 0/3] Radeon acpi vgapost Nishanth Aravamudan
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 14+ messages in thread
From: Michael Marineau @ 2005-08-28  1:34 UTC (permalink / raw)
  To: Andrew Morton, benh; +Cc: Pavel Machek, linux-kernel


[-- Attachment #1.1: Type: text/plain, Size: 196 bytes --]

Update documentation to reflect that this patch is now in the kernel.

Signed-off-by: Michael Marineau <marineam@engr.orst.edu>
-- 
Michael Marineau
marineam@engr.orst.edu
Oregon State University

[-- Attachment #1.2: radeon-doc-update.patch --]
[-- Type: text/x-patch, Size: 879 bytes --]

Index: linux-2.6.13-rc7/Documentation/power/video.txt
===================================================================
--- linux-2.6.13-rc7.orig/Documentation/power/video.txt
+++ linux-2.6.13-rc7/Documentation/power/video.txt
@@ -42,9 +42,9 @@ There are a few types of systems where v
   vbestate restore < /tmp/delme; setfont <whatever>, and your video
   should work.
 
-(7) on some systems, it is possible to boot most of kernel, and then
-  POSTing bios works. Ole Rohne has patch to do just that at
-  http://dev.gentoo.org/~marineam/patch-radeonfb-2.6.11-rc2-mm2.
+(7) on some systems, it is possible to POST the bios from within the
+  kernel which allows for the use of a framebuffer. The radeonfb incudes
+  this capability.
 
 Now, if you pass acpi_sleep=something, and it does not work with your
 bios, you'll get a hard crash during resume. Be careful. Also it is

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 256 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 0/3] Radeon acpi vgapost
  2005-08-28  1:25 [PATCH 0/3] Radeon acpi vgapost Michael Marineau
                   ` (2 preceding siblings ...)
  2005-08-28  1:34 ` [PATCH 3/3] Documentation update for radeonfb Michael Marineau
@ 2005-08-28  5:12 ` Nishanth Aravamudan
  2005-08-28  7:44   ` Michael Marineau
  2005-08-28  6:54 ` Manuel Lauss
  2005-08-28 12:50 ` [PATCH 0/3] Radeon acpi vgapost Matthew Garrett
  5 siblings, 1 reply; 14+ messages in thread
From: Nishanth Aravamudan @ 2005-08-28  5:12 UTC (permalink / raw)
  To: Michael Marineau; +Cc: Andrew Morton, benh, Pavel Machek, linux-kernel

On 27.08.2005 [18:25:44 -0700], Michael Marineau wrote:
> Thses patches resume ATI radeon cards from acpi S3 suspend when using
> radeonfb by reposting the video bios. This is needed to be able to use
> S3 when the framebuffer is enabled.

Just wanted to report that these patches lead to progress on my T41p;
relevant lspci -vvv:

0000:01:00.0 VGA compatible controller: ATI Technologies Inc M10 NT [FireGL Mobility T2] (rev 80) (prog-if 00 [VGA])
	Subsystem: IBM: Unknown device 054f
	Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR+ FastB2B+
	Status: Cap+ 66MHz+ UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR-
	Latency: 66 (2000ns min), Cache Line Size: 0x08 (32 bytes)
	Interrupt: pin A routed to IRQ 11
	Region 0: Memory at e0000000 (32-bit, prefetchable) [size=128M]
	Region 1: I/O ports at 3000 [size=256]
	Region 2: Memory at c0100000 (32-bit, non-prefetchable) [size=64K]
	Capabilities: <available only to root>

In 2.6.13-rc7 or 2.6.13-rc6-mm2, after echo mem > /sys/power/state, the
lcd light comes back, but no video is actually displayed (I just notice
that the backlight turns on). With your patches, I now see (with either
rc7 or rc6-mm2) a mostly black screen with "inux" in the upper left --
basically a garbled console -- which slowly turns completely white.

If you would like me to do more debugging, I would be more than happy to
do so.

Thanks for the work so far,
Nish

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 0/3] Radeon acpi vgapost
  2005-08-28  1:25 [PATCH 0/3] Radeon acpi vgapost Michael Marineau
                   ` (3 preceding siblings ...)
  2005-08-28  5:12 ` [PATCH 0/3] Radeon acpi vgapost Nishanth Aravamudan
@ 2005-08-28  6:54 ` Manuel Lauss
  2005-08-28  7:31   ` [PATCH 4/3] Radeon acpi vgapost only Rv250 (M9) Michael Marineau
  2005-08-28 12:50 ` [PATCH 0/3] Radeon acpi vgapost Matthew Garrett
  5 siblings, 1 reply; 14+ messages in thread
From: Manuel Lauss @ 2005-08-28  6:54 UTC (permalink / raw)
  To: Michael Marineau; +Cc: Andrew Morton, benh, Pavel Machek, linux-kernel

Michael Marineau wrote:
> Thses patches resume ATI radeon cards from acpi S3 suspend when using
> radeonfb by reposting the video bios. This is needed to be able to use
> S3 when the framebuffer is enabled.

These patches break resume from S3 for me. On a vanilla kernel,
radeonfb comes back fine, with your patches applied, the backlight
gets turned on (by BIOS I think) and shortly afterwards its turned off
for good. (Radeon M11 on Sony Vaio)

-- 
  Manuel Lauss


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 4/3] Radeon acpi vgapost only Rv250 (M9)
  2005-08-28  6:54 ` Manuel Lauss
@ 2005-08-28  7:31   ` Michael Marineau
  0 siblings, 0 replies; 14+ messages in thread
From: Michael Marineau @ 2005-08-28  7:31 UTC (permalink / raw)
  To: Manuel Lauss; +Cc: Andrew Morton, benh, Pavel Machek, linux-kernel


[-- Attachment #1.1: Type: text/plain, Size: 808 bytes --]

Manuel Lauss wrote:
> Michael Marineau wrote:
> 
>> Thses patches resume ATI radeon cards from acpi S3 suspend when using
>> radeonfb by reposting the video bios. This is needed to be able to use
>> S3 when the framebuffer is enabled.
> 
> 
> These patches break resume from S3 for me. On a vanilla kernel,
> radeonfb comes back fine, with your patches applied, the backlight
> gets turned on (by BIOS I think) and shortly afterwards its turned off
> for good. (Radeon M11 on Sony Vaio)
> 
Ok, attached is a patch to only attempt a vga post on Rv250 cards (M9)
which I have in my laptop.  I'm guessing cards older than M9 might also
be helped with this patch, but better to be conservative than risk
breaking systems that do work properly.
-- 
Michael Marineau
marineam@engr.orst.edu
Oregon State University

[-- Attachment #1.2: radeonfb-only-post-R250.patch --]
[-- Type: text/x-patch, Size: 631 bytes --]

Index: linux-2.6.13-rc7/drivers/video/aty/radeon_pm.c
===================================================================
--- linux-2.6.13-rc7.orig/drivers/video/aty/radeon_pm.c
+++ linux-2.6.13-rc7/drivers/video/aty/radeon_pm.c
@@ -2790,7 +2790,8 @@ void radeonfb_pm_init(struct radeonfb_in
 #endif /* defined(CONFIG_PM) && defined(CONFIG_PPC_OF) */
 
 #if defined(CONFIG_ACPI) && defined(CONFIG_X86)
-	if (rinfo->is_mobility && rinfo->pm_reg) {
+	if (rinfo->is_mobility && rinfo->pm_reg &&
+	     rinfo->family == CHIP_FAMILY_RV250) {
 		rinfo->reinit_func = radeon_reinitialize_vgapost;
 		rinfo->pm_mode |= radeon_pm_post;
 	}

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 256 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 0/3] Radeon acpi vgapost
  2005-08-28  5:12 ` [PATCH 0/3] Radeon acpi vgapost Nishanth Aravamudan
@ 2005-08-28  7:44   ` Michael Marineau
  2005-08-28 18:08     ` Nishanth Aravamudan
  0 siblings, 1 reply; 14+ messages in thread
From: Michael Marineau @ 2005-08-28  7:44 UTC (permalink / raw)
  To: Nishanth Aravamudan; +Cc: Andrew Morton, benh, Pavel Machek, linux-kernel

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

Nishanth Aravamudan wrote:
> On 27.08.2005 [18:25:44 -0700], Michael Marineau wrote:
> 
>>Thses patches resume ATI radeon cards from acpi S3 suspend when using
>>radeonfb by reposting the video bios. This is needed to be able to use
>>S3 when the framebuffer is enabled.
> 
> 
> Just wanted to report that these patches lead to progress on my T41p;
> relevant lspci -vvv:
> 
> 0000:01:00.0 VGA compatible controller: ATI Technologies Inc M10 NT [FireGL Mobility T2] (rev 80) (prog-if 00 [VGA])
> 	Subsystem: IBM: Unknown device 054f
> 	Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR+ FastB2B+
> 	Status: Cap+ 66MHz+ UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR-
> 	Latency: 66 (2000ns min), Cache Line Size: 0x08 (32 bytes)
> 	Interrupt: pin A routed to IRQ 11
> 	Region 0: Memory at e0000000 (32-bit, prefetchable) [size=128M]
> 	Region 1: I/O ports at 3000 [size=256]
> 	Region 2: Memory at c0100000 (32-bit, non-prefetchable) [size=64K]
> 	Capabilities: <available only to root>
> 
> In 2.6.13-rc7 or 2.6.13-rc6-mm2, after echo mem > /sys/power/state, the
> lcd light comes back, but no video is actually displayed (I just notice
> that the backlight turns on). With your patches, I now see (with either
> rc7 or rc6-mm2) a mostly black screen with "inux" in the upper left --
> basically a garbled console -- which slowly turns completely white.

I've seen the "inux" thing in the past, but by pressing a key shortly
after the screen turns back on the system continued to resume as usual.
 Given that the backlight normally turns back on for you maybe this post
method isn't the correct solution for your card. Mine wouldn't even turn
on the backlight.

> 
> If you would like me to do more debugging, I would be more than happy to
> do so.

What is the behaviour when the framebuffer is not enabled? If in that
case it doesn't work out of the box, does it work with a userspace trick
like vbetool?

-- 
Michael Marineau
marineam@engr.orst.edu
Oregon State University

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 256 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/3] Generic acpi vgapost
  2005-08-28  1:27 ` [PATCH 1/3] Generic " Michael Marineau
@ 2005-08-28  8:07   ` Pavel Machek
  2005-08-28 20:56   ` Jiri Slaby
  2005-08-30 10:51   ` Dave Airlie
  2 siblings, 0 replies; 14+ messages in thread
From: Pavel Machek @ 2005-08-28  8:07 UTC (permalink / raw)
  To: Michael Marineau; +Cc: Andrew Morton, benh, linux-kernel

Hi!

> Generic function to post the video bios.
> 
> Based directly on the original patch by Ole Rohne.
> 
> Signed-off-by: Michael Marineau <marineam@engr.orst.edu>

(Just FYI, I already ACKed those patches, and I'll like them to go in
after some testing in -mm).
								Pavel
-- 
if you have sharp zaurus hardware you don't need... you know my address

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 0/3] Radeon acpi vgapost
  2005-08-28  1:25 [PATCH 0/3] Radeon acpi vgapost Michael Marineau
                   ` (4 preceding siblings ...)
  2005-08-28  6:54 ` Manuel Lauss
@ 2005-08-28 12:50 ` Matthew Garrett
  5 siblings, 0 replies; 14+ messages in thread
From: Matthew Garrett @ 2005-08-28 12:50 UTC (permalink / raw)
  To: Michael Marineau; +Cc: linux-kernel

Michael Marineau <marineam@engr.orst.edu> wrote:

> Thses patches resume ATI radeon cards from acpi S3 suspend when using
> radeonfb by reposting the video bios. This is needed to be able to use
> S3 when the framebuffer is enabled.

Please don't make this unconditional. There's no guarantee whatsoever
that the code at c000:0003 does anything useful on a laptop, and it may
actually be harmful in some cases. The sensible approach is to whitelist
it based on DMI entries or provide a sysfs attribute so userspace can
enable/disable it.

How well does this patch deal with multihead? If I have a mixed
radeon/non-radeon system, and the primary head is a non-radeon, won't
this result in the wrong card being POSTed?

-- 
Matthew Garrett | mjg59-chiark.mail.linux-rutgers.kernel@srcf.ucam.org

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 0/3] Radeon acpi vgapost
@ 2005-08-28 17:58 Erik Andrén
  0 siblings, 0 replies; 14+ messages in thread
From: Erik Andrén @ 2005-08-28 17:58 UTC (permalink / raw)
  To: linux-kernel

Sadly, this patches doesn't improve the situation for my Mobility M7 
mounted on a Dell C640.
(and no, I didn't apply the 4:th patch regarding locking it to only the 
M9 version).
Everything but the display resumes properly.
All I get is a small white box which I can move about using the mouse.
Switching between virtual terminals doesn't improve the situation either.

I'll gladly help you out if you want me to do some testing.

With best regards
Erik Andrén

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 0/3] Radeon acpi vgapost
  2005-08-28  7:44   ` Michael Marineau
@ 2005-08-28 18:08     ` Nishanth Aravamudan
  0 siblings, 0 replies; 14+ messages in thread
From: Nishanth Aravamudan @ 2005-08-28 18:08 UTC (permalink / raw)
  To: Michael Marineau; +Cc: Andrew Morton, benh, Pavel Machek, linux-kernel

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

On 28.08.2005 [00:44:05 -0700], Michael Marineau wrote:
> Nishanth Aravamudan wrote:
> > On 27.08.2005 [18:25:44 -0700], Michael Marineau wrote:
> > 
> >>Thses patches resume ATI radeon cards from acpi S3 suspend when using
> >>radeonfb by reposting the video bios. This is needed to be able to use
> >>S3 when the framebuffer is enabled.
> > 
> > 
> > Just wanted to report that these patches lead to progress on my T41p;
> > relevant lspci -vvv:
> > 
> > 0000:01:00.0 VGA compatible controller: ATI Technologies Inc M10 NT [FireGL Mobility T2] (rev 80) (prog-if 00 [VGA])
> > 	Subsystem: IBM: Unknown device 054f
> > 	Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR+ FastB2B+
> > 	Status: Cap+ 66MHz+ UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR-
> > 	Latency: 66 (2000ns min), Cache Line Size: 0x08 (32 bytes)
> > 	Interrupt: pin A routed to IRQ 11
> > 	Region 0: Memory at e0000000 (32-bit, prefetchable) [size=128M]
> > 	Region 1: I/O ports at 3000 [size=256]
> > 	Region 2: Memory at c0100000 (32-bit, non-prefetchable) [size=64K]
> > 	Capabilities: <available only to root>
> > 
> > In 2.6.13-rc7 or 2.6.13-rc6-mm2, after echo mem > /sys/power/state, the
> > lcd light comes back, but no video is actually displayed (I just notice
> > that the backlight turns on). With your patches, I now see (with either
> > rc7 or rc6-mm2) a mostly black screen with "inux" in the upper left --
> > basically a garbled console -- which slowly turns completely white.
> 
> I've seen the "inux" thing in the past, but by pressing a key shortly
> after the screen turns back on the system continued to resume as usual.
>  Given that the backlight normally turns back on for you maybe this post
> method isn't the correct solution for your card. Mine wouldn't even turn
> on the backlight.

Oh ok, thanks. I tried the keypress and nothing happened.

> > 
> > If you would like me to do more debugging, I would be more than happy to
> > do so.
> 
> What is the behaviour when the framebuffer is not enabled? If in that
> case it doesn't work out of the box, does it work with a userspace trick
> like vbetool?

It definitely doesn't work OOB for me. I didn't know about vbetool
before (I have messed with radeontool, though, when I told BenH about
this problem a while ago).

Here is what I ended up with in my lidbtn.sh (when I wish to
sleep-to-mem):

chvt 1 //vbetool needs to run from text console
echo mem > /sys/power/state
vbetool post //brings back video mode correctly
chvt 7 //return to X

This seems to work, if the framebuffer is not enabled.

radeontool's regs argument provides some useful information, I think. I
have attache three files, radeontool.pre, radeontool.post and
radeontool.postpost, which capture the output of radeontool regs before
the suspend, after the suspend and after the vbetool command
respectively. As you can see, there is a significant difference between
.pre and .post and less of one between .pre and .postpost.

Perhaps also useful, I have attached the equivalent output with the fb
enabled, in radeontool.fb.pre, radeontool.fb.post and
radeontool.fb.postpost.

Thanks,
Nish

[-- Attachment #2: radeontool.pre --]
[-- Type: text/plain, Size: 492 bytes --]

RADEON_DAC_CNTL=ff000002
RADEON_DAC_CNTL2=00000000
RADEON_TV_DAC_CNTL=07770142
RADEON_DISP_OUTPUT_CNTL=1000000a
RADEON_CONFIG_MEMSIZE=08000000
RADEON_AUX_SC_CNTL=00000000
RADEON_CRTC_EXT_CNTL=0f000000
RADEON_CRTC_GEN_CNTL=02000200
RADEON_CRTC2_GEN_CNTL=00800000
RADEON_DEVICE_ID=00004e54
RADEON_DISP_MISC_CNTL=5b300600
RADEON_GPIO_MONID=00000000
RADEON_GPIO_MONIDB=00000000
RADEON_GPIO_CRT2_DDC=00000000
RADEON_GPIO_DVI_DDC=00000300
RADEON_GPIO_VGA_DDC=00000300
RADEON_LVDS_GEN_CNTL=003cffa1

[-- Attachment #3: radeontool.post --]
[-- Type: text/plain, Size: 492 bytes --]

RADEON_DAC_CNTL=ff000002
RADEON_DAC_CNTL2=00000000
RADEON_TV_DAC_CNTL=00770103
RADEON_DISP_OUTPUT_CNTL=1000000a
RADEON_CONFIG_MEMSIZE=08000000
RADEON_AUX_SC_CNTL=00000000
RADEON_CRTC_EXT_CNTL=0f000000
RADEON_CRTC_GEN_CNTL=02000200
RADEON_CRTC2_GEN_CNTL=02000000
RADEON_DEVICE_ID=00004e54
RADEON_DISP_MISC_CNTL=5b300600
RADEON_GPIO_MONID=00000000
RADEON_GPIO_MONIDB=00000000
RADEON_GPIO_CRT2_DDC=00000000
RADEON_GPIO_DVI_DDC=00000300
RADEON_GPIO_VGA_DDC=00000300
RADEON_LVDS_GEN_CNTL=08000008

[-- Attachment #4: radeontool.postpost --]
[-- Type: text/plain, Size: 492 bytes --]

RADEON_DAC_CNTL=ff000002
RADEON_DAC_CNTL2=00000000
RADEON_TV_DAC_CNTL=07770142
RADEON_DISP_OUTPUT_CNTL=1000000a
RADEON_CONFIG_MEMSIZE=08000000
RADEON_AUX_SC_CNTL=00000000
RADEON_CRTC_EXT_CNTL=00000000
RADEON_CRTC_GEN_CNTL=02000200
RADEON_CRTC2_GEN_CNTL=00800000
RADEON_DEVICE_ID=00004e54
RADEON_DISP_MISC_CNTL=5b300600
RADEON_GPIO_MONID=00000000
RADEON_GPIO_MONIDB=00000000
RADEON_GPIO_CRT2_DDC=00000000
RADEON_GPIO_DVI_DDC=00000300
RADEON_GPIO_VGA_DDC=00000300
RADEON_LVDS_GEN_CNTL=003cffa1

[-- Attachment #5: radeontool.fb.pre --]
[-- Type: text/plain, Size: 492 bytes --]

RADEON_DAC_CNTL=ff002102
RADEON_DAC_CNTL2=00000000
RADEON_TV_DAC_CNTL=07770142
RADEON_DISP_OUTPUT_CNTL=1000000a
RADEON_CONFIG_MEMSIZE=08000000
RADEON_AUX_SC_CNTL=00000000
RADEON_CRTC_EXT_CNTL=0d000048
RADEON_CRTC_GEN_CNTL=03000200
RADEON_CRTC2_GEN_CNTL=00800000
RADEON_DEVICE_ID=00004e54
RADEON_DISP_MISC_CNTL=5b300600
RADEON_GPIO_MONID=00000000
RADEON_GPIO_MONIDB=00000000
RADEON_GPIO_CRT2_DDC=00000000
RADEON_GPIO_DVI_DDC=00000300
RADEON_GPIO_VGA_DDC=00000300
RADEON_LVDS_GEN_CNTL=003cffa1

[-- Attachment #6: radeontool.fb.post --]
[-- Type: text/plain, Size: 492 bytes --]

RADEON_DAC_CNTL=ff002102
RADEON_DAC_CNTL2=00000000
RADEON_TV_DAC_CNTL=00770103
RADEON_DISP_OUTPUT_CNTL=1000000a
RADEON_CONFIG_MEMSIZE=08000000
RADEON_AUX_SC_CNTL=00000000
RADEON_CRTC_EXT_CNTL=00000048
RADEON_CRTC_GEN_CNTL=03000200
RADEON_CRTC2_GEN_CNTL=02000000
RADEON_DEVICE_ID=00004e54
RADEON_DISP_MISC_CNTL=5b300600
RADEON_GPIO_MONID=00000000
RADEON_GPIO_MONIDB=00000000
RADEON_GPIO_CRT2_DDC=00000000
RADEON_GPIO_DVI_DDC=00000300
RADEON_GPIO_VGA_DDC=00000300
RADEON_LVDS_GEN_CNTL=080c0089

[-- Attachment #7: radeontool.fb.postpost --]
[-- Type: text/plain, Size: 492 bytes --]

RADEON_DAC_CNTL=ff000002
RADEON_DAC_CNTL2=00000000
RADEON_TV_DAC_CNTL=07770142
RADEON_DISP_OUTPUT_CNTL=1000000a
RADEON_CONFIG_MEMSIZE=08000000
RADEON_AUX_SC_CNTL=00000000
RADEON_CRTC_EXT_CNTL=00000000
RADEON_CRTC_GEN_CNTL=02000200
RADEON_CRTC2_GEN_CNTL=00800000
RADEON_DEVICE_ID=00004e54
RADEON_DISP_MISC_CNTL=5b300600
RADEON_GPIO_MONID=00000000
RADEON_GPIO_MONIDB=00000000
RADEON_GPIO_CRT2_DDC=00000000
RADEON_GPIO_DVI_DDC=00000300
RADEON_GPIO_VGA_DDC=00000300
RADEON_LVDS_GEN_CNTL=003cffa1

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/3] Generic acpi vgapost
  2005-08-28  1:27 ` [PATCH 1/3] Generic " Michael Marineau
  2005-08-28  8:07   ` Pavel Machek
@ 2005-08-28 20:56   ` Jiri Slaby
  2005-08-30 10:51   ` Dave Airlie
  2 siblings, 0 replies; 14+ messages in thread
From: Jiri Slaby @ 2005-08-28 20:56 UTC (permalink / raw)
  To: Michael Marineau; +Cc: Andrew Morton, benh, Pavel Machek, linux-kernel

Michael Marineau napsal(a):

>Generic function to post the video bios.
>
>Based directly on the original patch by Ole Rohne.
>
>Signed-off-by: Michael Marineau <marineam@engr.orst.edu>
>  
>
>------------------------------------------------------------------------
>
>Index: linux-2.6.13-rc7/arch/i386/kernel/acpi/sleep.c
>===================================================================
>--- linux-2.6.13-rc7.orig/arch/i386/kernel/acpi/sleep.c
>+++ linux-2.6.13-rc7/arch/i386/kernel/acpi/sleep.c
>@@ -5,6 +5,7 @@
>  *  Copyright (C) 2001-2003 Pavel Machek <pavel@suse.cz>
>  */
> 
>+#include <linux/module.h>
> #include <linux/acpi.h>
> #include <linux/bootmem.h>
> #include <linux/dmi.h>
>@@ -56,6 +57,34 @@ void acpi_restore_state_mem (void)
> 	zap_low_mappings();
> }
> 
>+/*
>+ * acpi_vgapost
>+ */
>+
>+extern void do_vgapost_lowlevel (unsigned long);
>+
>+void acpi_vgapost (unsigned long slot)
>+{
>+	unsigned long flags, saved_video_flags = acpi_video_flags;
>+
>+	acpi_video_flags = (slot & 0xffff) << 16 | 1;
>+
>+	/* Map low memory and copy information */
>+	init_low_mapping(swapper_pg_dir, USER_PTRS_PER_PGD);
>+	memcpy((void *) acpi_wakeup_address, &wakeup_start, &wakeup_end - &wakeup_start);
>  
>
80 chars on a line, again...

>+	acpi_copy_wakeup_routine(acpi_wakeup_address);
>+
>+	/* Tunnel thru real mode */
>+	local_irq_save(flags);
>+	do_vgapost_lowlevel(acpi_wakeup_address);
>+	local_irq_restore(flags);
>  
>

-- 
Jiri Slaby         www.fi.muni.cz/~xslaby
~\-/~      jirislaby@gmail.com      ~\-/~
241B347EC88228DE51EE A49C4A73A25004CB2A10


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/3] Generic acpi vgapost
  2005-08-28  1:27 ` [PATCH 1/3] Generic " Michael Marineau
  2005-08-28  8:07   ` Pavel Machek
  2005-08-28 20:56   ` Jiri Slaby
@ 2005-08-30 10:51   ` Dave Airlie
  2 siblings, 0 replies; 14+ messages in thread
From: Dave Airlie @ 2005-08-30 10:51 UTC (permalink / raw)
  To: Michael Marineau; +Cc: Andrew Morton, benh, Pavel Machek, linux-kernel

On 8/28/05, Michael Marineau <marineam@engr.orst.edu> wrote:
> Generic function to post the video bios.
> 
> Based directly on the original patch by Ole Rohne.
> 
> Signed-off-by: Michael Marineau <marineam@engr.orst.edu>

The wakeup.S code is missing a small piece of code.

For a  lot of BIOSes you need to set ax to a PCI ID, I have code in my
tree at the moment that does this:

in do_vgapost_lowlevel:
acpi_video_devnum = (pci_dev->bus->number<<8) | (pci_dev->devfn);

and then in the wakeup code
movl video_devnum-wakeup_code, %eax

The code is all in the patch at
http://www.skynet.ie/~airlied/patches/lk/my_pm_diffs
This is just a drop of my current tree from when I was hacking on
suspend/resume at OLS.

Dave.

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2005-08-30 10:52 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-28  1:25 [PATCH 0/3] Radeon acpi vgapost Michael Marineau
2005-08-28  1:27 ` [PATCH 1/3] Generic " Michael Marineau
2005-08-28  8:07   ` Pavel Machek
2005-08-28 20:56   ` Jiri Slaby
2005-08-30 10:51   ` Dave Airlie
2005-08-28  1:31 ` [PATCH 2/3] Radeon " Michael Marineau
2005-08-28  1:34 ` [PATCH 3/3] Documentation update for radeonfb Michael Marineau
2005-08-28  5:12 ` [PATCH 0/3] Radeon acpi vgapost Nishanth Aravamudan
2005-08-28  7:44   ` Michael Marineau
2005-08-28 18:08     ` Nishanth Aravamudan
2005-08-28  6:54 ` Manuel Lauss
2005-08-28  7:31   ` [PATCH 4/3] Radeon acpi vgapost only Rv250 (M9) Michael Marineau
2005-08-28 12:50 ` [PATCH 0/3] Radeon acpi vgapost Matthew Garrett
  -- strict thread matches above, loose matches on Subject: below --
2005-08-28 17:58 Erik Andrén

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox