15 #include <linux/kernel.h>
20 #include <linux/slab.h>
24 #if CONFIG_SAMSUNG_PM_CHECK_CHUNKSIZE < 1
25 #error CONFIG_SAMSUNG_PM_CHECK_CHUNKSIZE must be a positive non-zero value
38 #define CHECK_CHUNKSIZE (CONFIG_SAMSUNG_PM_CHECK_CHUNKSIZE * 1024)
54 s3c_pm_run_res(ptr->
child, fn, arg);
58 S3C_PMDBG(
"Found system RAM at %08lx..%08lx\n",
59 (
unsigned long)ptr->
start,
60 (
unsigned long)ptr->
end);
68 static void s3c_pm_run_sysram(
run_fn_t fn,
u32 *arg)
80 S3C_PMDBG(
"Area %08lx..%08lx, %d blocks\n",
81 (
unsigned long)res->
start, (
unsigned long)res->
end, size);
83 *val += size *
sizeof(
u32);
99 s3c_pm_run_sysram(s3c_pm_countram, &crc_size);
101 S3C_PMDBG(
"s3c_pm_prepare_check: %u checks needed\n", crc_size);
112 for (addr = res->
start; addr < res->
end;
135 s3c_pm_run_sysram(s3c_pm_makecheck, crcs);
144 static inline int in_region(
void *ptr,
int size,
void *
what,
size_t whatsz)
146 if ((what+whatsz) < ptr)
149 if (what > (ptr+size))
175 for (addr = res->
start; addr < res->
end;
184 if (in_region(ptr, left, stkpage, 4096)) {
185 S3C_PMDBG(
"skipping %08lx, has stack in\n", addr);
189 if (in_region(ptr, left, crcs, crc_size)) {
190 S3C_PMDBG(
"skipping %08lx, has crc block in\n", addr);
199 "%08lx (%08x vs %08x)\n", addr, calc, *val);
201 S3C_PMDBG(
"Restore CRC error at %08lx (%08x vs %08x)\n",
221 s3c_pm_run_sysram(s3c_pm_runcheck, crcs);