]>
Commit | Line | Data |
---|---|---|
83d290c5 | 1 | // SPDX-License-Identifier: GPL-2.0+ |
68145d4c | 2 | /* |
09c2b8f3 | 3 | * Copyright (c) 2015 Andreas Bießmann <[email protected]> |
68145d4c AB |
4 | * |
5 | * Copyright (c) 2011 The Chromium OS Authors. | |
6 | * (C) Copyright 2002-2006 | |
7 | * Wolfgang Denk, DENX Software Engineering, [email protected]. | |
8 | * | |
9 | * (C) Copyright 2002 | |
10 | * Sysgo Real-Time Solutions, GmbH <www.elinos.com> | |
11 | * Marius Groeger <[email protected]> | |
68145d4c | 12 | */ |
691d719d | 13 | #include <init.h> |
8120e068 | 14 | #include <lmb.h> |
401d1c4f | 15 | #include <asm/global_data.h> |
68145d4c AB |
16 | |
17 | DECLARE_GLOBAL_DATA_PTR; | |
18 | ||
19 | int arch_reserve_stacks(void) | |
20 | { | |
21 | #ifdef CONFIG_SPL_BUILD | |
22 | gd->start_addr_sp -= 128; /* leave 32 words for abort-stack */ | |
23 | gd->irq_sp = gd->start_addr_sp; | |
24 | #else | |
25 | /* setup stack pointer for exceptions */ | |
26 | gd->irq_sp = gd->start_addr_sp; | |
27 | ||
28 | # if !defined(CONFIG_ARM64) | |
68145d4c AB |
29 | /* leave 3 words for abort-stack, plus 1 for alignment */ |
30 | gd->start_addr_sp -= 16; | |
31 | # endif | |
32 | #endif | |
33 | ||
34 | return 0; | |
35 | } | |
8120e068 MV |
36 | |
37 | static ulong get_sp(void) | |
38 | { | |
39 | ulong ret; | |
40 | ||
41 | asm("mov %0, sp" : "=r"(ret) : ); | |
42 | return ret; | |
43 | } | |
44 | ||
45 | void arch_lmb_reserve(struct lmb *lmb) | |
46 | { | |
b1d0487c | 47 | arch_lmb_reserve_generic(lmb, get_sp(), gd->ram_top, 16384); |
8120e068 | 48 | } |