OLPC: Add XO-1 suspend/resume support
PATCH RESEND v4 1/1 OLPC: Add XO-1 suspend/resume support
Add code needed for basic suspend/resume of the XO-1 laptop.
--- arch/x86/Kconfig | 2 +- arch/x86/include/asm/olpc.h | 9 ++- arch/x86/platform/olpc/Makefile | 2 +- arch/x86/platform/olpc/olpc-xo1-wakeup.S | 132 ++++++++++++++++++++++++++++++ arch/x86/platform/olpc/olpc-xo1.c | 79 ++++++++++++++++++ 5 files changed, 219 insertions(+), 5 deletions(-) create mode 100644 arch/x86/platform/olpc/olpc-xo1-wakeup.S
I've submitted this 5 times over the last few weeks, am I being too impatient/persistant? Code is too horrible to even warrant review comments?
http://marc.info/?l=linux-kernel&m=128752574203087&w=2
http://marc.info/?l=linux-kernel&m=128758786712015&w=2
http://marc.info/?l=linux-kernel&m=128818888428639&w=2
http://marc.info/?l=linux-kernel&m=128836342103914&w=2
http://marc.info/?l=linux-kernel&m=128948775532145&w=2
Feedback after the first submission was quickly acted upon and I haven't been able to get a peep since.
v2: add dependency on CONFIG_PM_SLEEP (thanks Randy), avoid requirement on hacking swsusp_pg_dir by switching to initial_page_table
v3: rebase to fix conflict in olpc.h with the now-merged XO-1 rfkill driver
v4: update for arch/x86/platform/olpc code move
arch/x86/Kconfig +1 -1
@@ -2041,7 +2041,7 @@ config OLPC config OLPC_XO1 tristate "OLPC XO-1 support" - depends on OLPC && PCI + depends on OLPC && PCI && PM_SLEEP ---help--- Add support for non-essential features of the OLPC XO-1 laptop.
arch/x86/include/asm/olpc.h +6 -3
@@ -88,9 +88,12 @@ extern int olpc_ec_mask_unset(uint8_t bits);/* EC commands */ -#define EC_FIRMWARE_REV 0x08 -#define EC_WLAN_ENTER_RESET 0x35 -#define EC_WLAN_LEAVE_RESET 0x25 +#define EC_FIRMWARE_REV 0x08 +#define EC_WAKE_UP_WLAN 0x24 +#define EC_WLAN_LEAVE_RESET 0x25 +#define EC_SET_SCI_INHIBIT 0x32 +#define EC_SET_SCI_INHIBIT_RELEASE 0x34 +#define EC_WLAN_ENTER_RESET 0x35/* SCI source values */
arch/x86/platform/olpc/Makefile +1 -1
@@ -1,3 +1,3 @@ obj-$(CONFIG_OLPC) += olpc.o -obj-$(CONFIG_OLPC_XO1) += olpc-xo1.o +obj-$(CONFIG_OLPC_XO1) += olpc-xo1.o olpc-xo1-wakeup.o obj-$(CONFIG_OLPC_OPENFIRMWARE) += olpc_ofw.o
arch/x86/platform/olpc/olpc-xo1-wakeup.S new file +132 -0
132 lines not on this page · raw message
arch/x86/platform/olpc/olpc-xo1.c +79 -0
103 lines not on this page · raw message
Signature · 1 line
1.7.3.2
Quoted 2 lines · Daniel Drake
Feedback after the first submission was quickly acted upon and I haven't been able to get a peep since.
Sorry, fell off the radar.
arch/x86/platform/olpc/olpc-xo1-wakeup.S line 18
Quoted 3 lines
arch/x86/platform/olpc/olpc-xo1-wakeup.S new file +3
-0+ +wakeup_start: +# jmp wakeup_start
Debug leftover ?
arch/x86/platform/olpc/olpc-xo1.c line 89
Quoted 7 lines
arch/x86/platform/olpc/olpc-xo1.c +7
-0+asmlinkage int olpc_xo1_do_sleep(u8 sleep_state) +{ +void *pgd_addr =__va (read_cr3 ()); +printk (KERN_ERR "xo1_do_sleep!\n" );/* this needs to remain here so +* that gcc doesn't optimize +* away our __va! */ +
This looks suspect along with the __volatile__ magic below. Care to explain, what you fear that gcc is optimizing away ?
arch/x86/platform/olpc/olpc-xo1.c line 99
Quoted 10 lines
arch/x86/platform/olpc/olpc-xo1.c +10
-0+/* Enable wakeup through power button */ +outl ((CS5536_PM_PWRBTN <<16 ) |0xFFFF , acpi_base +PM1_STS ); + + __asm__ __volatile__("movl %0,%%eax" : :"r" (pgd_addr)); + __asm__("call *(%%edi); cld" + : :"D" (&ofw_bios_entry)); + __asm__ __volatile__("movb $0x34, %al\n\t" +"outb %al, $0x70\n\t" +"movb $0x30, %al\n\t" +"outb %al, $0x71\n\t" );
Looks good otherwise.
Thanks,
tglx
A message that is not in the archive (sent off-list or not yet received): [email protected]
On Fri, 26 Nov 2010 16:28:51 +0000
Daniel Drake <[email protected]> wrote:
[...]
Quoted 2 lines
Re. the printk thing, this was your doing:
http://dev.laptop.org/git/olpc-2.6/commit/?h=stable&id=b4334e9e1444761f19806f9066c6b38ce23079bf
[...]
Quoted 12 lines
---------- Forwarded message ----------
From: Thomas Gleixner <[email protected]>
Date: 26 November 2010 09:43
Subject: Re: [PATCH v4 resend] OLPC: Add XO-1 suspend/resume support
To: Daniel Drake <[email protected]>
Cc: [email protected], [email protected]Quoted 2 lines · Daniel Drake
Feedback after the first submission was quickly acted upon and I haven't been able to get a peep since.
Quoted 7 lines
Sorry, fell off the radar.
arch/x86/platform/olpc/olpc-xo1-wakeup.S line 18
Quoted 3 lines
arch/x86/platform/olpc/olpc-xo1-wakeup.S new file +3
-0+ +wakeup_start: +# jmp wakeup_startDebug leftover ?
Leftovers from the original patch; certainly should be removed.
Quoted 14 lines
Quoted 10 lines
arch/x86/platform/olpc/olpc-xo1.c +4
-0+asmlinkage int olpc_xo1_do_sleep(u8 sleep_state) +{ + void *pgd_addr = __va(read_cr3()); + printk(KERN_ERR "xo1_do_sleep!\n"); /* this needs to remainhere so
+ * that gcc doesn't optimize
+ * away our__va! */ +This looks suspect along with the
__volatile__magic below. Care to explain, what you fear that gcc is optimizing away ?
I'm working from memory here; in the version of gcc we were using at the time (stock FC5 or FC6), setting pgd_addr immediately followed by the asm below resulted in gcc optimizing away the __va(). The asm turned into simply:
movl %cr3, %eax
With no mention of PAGE_OFFSET. Messing with 'volatile' didn't help. Adding the printk did, as it causes %eax to get clobbered, forcing temporary storage of %cr3 into a separate register. A lot has changed since then (compilers, this code, as well as the definition of read_cr3()), so I highly suspect that it's no longer needed.
Quoted 16 lines
Quoted 10 lines
+ /* Enable wakeup through power button */
+outl((CS5536_PM_PWRBTN << 16) | 0xFFFF, acpi_base + PM1_STS); +
+__asm____volatile__("movl %0,%%eax" : : "r" (pgd_addr));
+ __asm__("call *(%%edi); cld"
+ : : "D" (&ofw_bios_entry));
+__asm____volatile__("movb $0x34, %al\n\t"
+ "outb %al, $0x70\n\t"
+ "movb $0x30, %al\n\t"
+ "outb %al, $0x71\n\t");Looks good otherwise.
Thanks,
tglx
Quoted 9 lines · On Thu, 18 Nov 2010 20:28:37 +0000 (GMT) Daniel Drake <[email protected]> wrote:
Add code needed for basic suspend/resume of the XO-1 laptop.
Signed-off-by Daniel Drake <[email protected]>--- arch/x86/Kconfig | 2 +- arch/x86/include/asm/olpc.h | 9 ++- arch/x86/platform/olpc/Makefile | 2 +- arch/x86/platform/olpc/olpc-xo1-wakeup.S | 132 ++++++++++++++++++++++++++++++ arch/x86/platform/olpc/olpc-xo1.c | 79 ++++++++++++++++++
i386 allmodconfig:
make[3]: *** No rule to make target `arch/x86/platform/olpc/olpc-xo1-wakeup.c',
I "fixed" that locally by making olpc depend on x86_64.
H. Peter Anvin
reviewerQuoted 13 lines · Andrew Morton
Quoted 9 lines · On Thu, 18 Nov 2010 20:28:37 +0000 (GMT) Daniel Drake <[email protected]> wrote:
Add code needed for basic suspend/resume of the XO-1 laptop.
Signed-off-by Daniel Drake <[email protected]>--- arch/x86/Kconfig | 2 +- arch/x86/include/asm/olpc.h | 9 ++- arch/x86/platform/olpc/Makefile | 2 +- arch/x86/platform/olpc/olpc-xo1-wakeup.S | 132 ++++++++++++++++++++++++++++++ arch/x86/platform/olpc/olpc-xo1.c | 79 ++++++++++++++++++
Quoted 5 lines
i386 allmodconfig:
make[3]: *** No rule to make target `arch/x86/platform/olpc/olpc-xo1-wakeup.c',
I "fixed" that locally by making olpc depend on
x86_64.
... which is of course completely busted since olpc is 32 bit.
-hpa
Signature · 2 lines
H. Peter Anvin, Intel Open Source Technology Center I work for Intel. I don't speak on their behalf.