From 683c50e27319d432176931bebb5aa172606783ac Mon Sep 17 00:00:00 2001 From: Stewart Smith Date: Tue, 16 Aug 2016 15:01:59 +1000 Subject: Adjust top_of_ram when we know cpu_max_pir for the processor generation This allows opal_addr_valid to perform the < top_of_mem check and pass for early xscom_reads that read into cpu stack. Arguably the more correct solution is to split opal_xscom_read from xscom_read and only validate for the OPAL call. Signed-off-by: Stewart Smith --- core/cpu.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/core/cpu.c b/core/cpu.c index a94c17a..78331cc 100644 --- a/core/cpu.c +++ b/core/cpu.c @@ -510,6 +510,13 @@ void init_boot_cpu(void) pir, pvr); prlog(PR_DEBUG, "CPU: Initial max PIR set to 0x%x\n", cpu_max_pir); + /* + * Adjust top of RAM to include CPU stacks. While we *could* have + * less RAM than this... during early boot, it's enough of a check + * until we start parsing device tree / hdat and find out for sure + */ + top_of_ram += (cpu_max_pir + 1) * STACK_SIZE; + /* Clear the CPU structs */ for (i = 0; i <= cpu_max_pir; i++) memset(&cpu_stacks[i].cpu, 0, sizeof(struct cpu_thread)); -- cgit v1.1