Some notes about s3c24xx suspend/resume (with htc-compatible loader)

Here's some interesting notes about suspend/resume with stock htc-compatible bootloader (rx1950, h1940, rx3000 PDAs)

After waking up from suspend bootloader:

  • checks if we really wake up from suspend (not power-on after power-off, etc)
  • performs quick memory check (it calculates simple checksum), if check was successfull jumps to physical address 0x30081000

But haret loads kernel to address 0x30008000. So resume address overlaps kernel space. To avoid kernel code corruption we should load kernel higher :) So, you'll need to patch your kernel to create offset for .text section, and also you'll need to patch haret.

Here's patch for haret:

diff -Naur haret/src/linboot.cpp haret.offset/src/linboot.cpp
--- haret/src/linboot.cpp 2007-04-15 20:13:41.000000000 +0200
+++ haret.offset/src/linboot.cpp 2007-04-26 19:52:13.000000000 +0200
@@ -87,7 +87,7 @@
// Recommended tags placement = RAM start + 256
#define PHYSOFFSET_TAGS 0x100
// Recommended kernel placement = RAM start + 32K
-#define PHYSOFFSET_KERNEL 0x8000
+#define PHYSOFFSET_KERNEL 0x98000
// Initrd will be put at the address of kernel + 5MB
#define PHYSOFFSET_INITRD (PHYSOFFSET_KERNEL + 0x500000)
// Maximum size of the tags structure.

Patch for kernel can be obtained here:

http://www.fluff.org/ben/linux-26/2620/2620-confgiurable-kernel-offset1.patch

Also we need to reserve 2 pages to prevent using them by kernel or userspace apps. For this you need to add some lines to arch/arm/mm/mmu.c in function reserve_node_zero:

if (machine_is_h1940() || machine_is_rx3715() || machine_is_rx1950()) {
reserve_bootmem_node(pgdat, 0x30003000, 0x1000,
BOOTMEM_DEFAULT);
reserve_bootmem_node(pgdat, 0x30081000, 0x1000,
BOOTMEM_DEFAULT);
}

Thats's all :) Now I have no crashes on my rx1950 with suspend enabled.

Comments

Popular posts from this blog

Access point with Raspberry Pi and rtl8192cu dongle

OLED brightness in Linux

Wayland and software rendering