Commit 257c6e1c authored by Heiko Carstens's avatar Heiko Carstens Committed by Martin Schwidefsky

[S390] memory detection: fix off by one bug.

diag 260 returns the address of the last addressable byte and not the
size of memory. Since we want the size we have to add 1 to the return
value.
Disable diag 260 for non z/Arch mode since it doesn't work there
anyway.
Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent dcc49d46
...@@ -141,9 +141,9 @@ static noinline __init void detect_machine_type(void) ...@@ -141,9 +141,9 @@ static noinline __init void detect_machine_type(void)
machine_flags |= 4; machine_flags |= 4;
} }
#ifdef CONFIG_64BIT
static noinline __init int memory_fast_detect(void) static noinline __init int memory_fast_detect(void)
{ {
unsigned long val0 = 0; unsigned long val0 = 0;
unsigned long val1 = 0xc; unsigned long val1 = 0xc;
int ret = -ENOSYS; int ret = -ENOSYS;
...@@ -161,9 +161,15 @@ static noinline __init int memory_fast_detect(void) ...@@ -161,9 +161,15 @@ static noinline __init int memory_fast_detect(void)
if (ret || val0 != val1) if (ret || val0 != val1)
return -ENOSYS; return -ENOSYS;
memory_chunk[0].size = val0; memory_chunk[0].size = val0 + 1;
return 0; return 0;
} }
#else
static inline int memory_fast_detect(void)
{
return -ENOSYS;
}
#endif
#define ADDR2G (1UL << 31) #define ADDR2G (1UL << 31)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment