| 1 |
/* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 |
|
| 3 |
#include <memlayout.h> |
| 4 |
|
| 5 |
#include <arch/header.ld> |
| 6 |
|
| 7 |
SECTIONS |
| 8 |
{ |
| 9 |
DRAM_START(0x0) |
| 10 |
|
| 11 |
/* |
| 12 |
* On POWER, 0 is wherever HRMOR points to rather than physical DRAM start. |
| 13 |
* HRMOR is ORed with address, not added to it, meaning that memory space |
| 14 |
* overlaps after 2^(least significant set bit of HRMOR). This becomes |
| 15 |
* chaotic when nonconsecutive bits are set... |
| 16 |
* |
| 17 |
* Two and a half possible cases: |
| 18 |
* 0. bootblock started with QEMU in hb-mode |
| 19 |
* - NIA = 0x10 (bug?) |
| 20 |
* - HRMOR = 0x08000000 (128M) |
| 21 |
* - no physical memory to enable/train, everything accessible from start |
| 22 |
* 1. bootblock loaded by HBBL |
| 23 |
* - NIA = 0 |
| 24 |
* - HRMOR = 0xF8000000 (4G - 128M) |
| 25 |
* - initialized L3 = 0x400000 (4M) |
| 26 |
* - top address before RAM = 0xF8400000 |
| 27 |
* 2. bootblock in SEEPROM, loaded by SBE |
| 28 |
* - NIA = 0x3000 (placeholder for int. vectors) |
| 29 |
* - HRMOR = 0xF8200000 (4G - 128 M + 2 M) |
| 30 |
* - initialized L3 = 0x8000 (bootblock/HBBL size = 32K) |
| 31 |
* - no way 32K will be enough, must initialize more L3 in bootblock |
| 32 |
* - HRMOR still applies, so memory overlaps every 2M |
| 33 |
* |
| 34 |
* Common subset (assuming 2. initializes as much memory as possible) is |
| 35 |
* 0xF8200000-0xF8400000. 2M should be more than enough for pre-RAM code, |
| 36 |
* but it isn't enough to load ramstage. We could implement postcar stage, |
| 37 |
* but KISS: initialize L3 from _ebootblock to 0xF8980000: up to 9.5M into |
| 38 |
* cache, leaving bottom 2M (0xF8000000-0xF8200000) either uninitialized |
| 39 |
* (when started from SEEPROM) or just unused for anything but bootblock |
| 40 |
* (loaded by HBBL). Last 0.5M of L3 cache is left for interrupt vectors |
| 41 |
* normally located at address 0. |
| 42 |
* |
| 43 |
* Set HRMOR to 0 before jumping to C code in bootblock and forget it even |
| 44 |
* exists. |
| 45 |
* |
| 46 |
* For QEMU s/0xF8/0x08/ in above description but code remains the same. |
| 47 |
* L3 initialization is unnecessary in this case but won't break anything. |
| 48 |
* |
| 49 |
* TODO: there is a structure with SBE->HBBL data at 0 in 2nd option. It |
| 50 |
* holds some useful data like XSCOM BAR and LPC BAR. If, for any reason, |
| 51 |
* these addresses are different than default, they should be used instead |
| 52 |
* of predefined values. |
| 53 |
*/ |
| 54 |
|
| 55 |
#if !CONFIG(BOOTBLOCK_IN_SEEPROM) |
| 56 |
BOOTBLOCK( 0xF8000000, 32K) |
| 57 |
#else |
| 58 |
BOOTBLOCK( 0xF8203000, 20K) |
| 59 |
#endif |
| 60 |
|
| 61 |
STACK( 0xF8208000, 32K) |
| 62 |
PRERAM_CBMEM_CONSOLE(0xF8210000, 128K) |
| 63 |
FMAP_CACHE( 0xF8230000, 4K) |
| 64 |
CBFS_MCACHE( 0xF8231000, 8K) |
| 65 |
TIMESTAMP( 0xF8233000, 4K) |
| 66 |
|
| 67 |
ROMSTAGE( 0xF8240000, 256K) |
| 68 |
|
| 69 |
/* |
| 70 |
* bootblock_crt0.S assumes this is the last part of L3, leaving for |
| 71 |
* interrupt vectors at least 0.5M because of cache associativity. If |
| 72 |
* more CBFS_CACHE is needed, split this into pre-/postram caches. |
| 73 |
*/ |
| 74 |
CBFS_CACHE( 0xF8280000, 7M) |
| 75 |
|
| 76 |
RAMSTAGE( 0xF9000000, 2M) |
| 77 |
} |