blob: c199118d2d520e067152049080bf9996fe026c38 [file] [log] [blame]
Patrick Georgi11f00792020-03-04 15:10:45 +01001/* SPDX-License-Identifier: GPL-2.0-only */
Aaron Durbin956c4f22015-09-05 13:31:14 -05002
3#include <memlayout.h>
4#include <arch/header.ld>
5
Jeremy Compostellab7832de2023-08-30 15:42:09 -07006/*
7 * The bootblock linker script should be included before the Cache-As-RAM linker
8 * script. Indeed, if it is included after and Cache-As-RAM .data section
9 * support is enabled, the definition order of the sections makes the linker
10 * create an image with an almost 4 GB hole.
11 */
12#if ENV_BOOTBLOCK
13INCLUDE "bootblock/arch/x86/bootblock.ld"
14#endif /* ENV_BOOTBLOCK */
15
Aaron Durbin956c4f22015-09-05 13:31:14 -050016SECTIONS
17{
18 /*
19 * It would be good to lay down RAMSTAGE, ROMSTAGE, etc consecutively
20 * like other architectures/chipsets it's not possible because of
21 * the linking games played during romstage creation by trying
22 * to find the final landing place in CBFS for XIP. Therefore,
23 * conditionalize with macros.
24 */
25#if ENV_RAMSTAGE
Arthur Heymans0c629872022-03-30 19:34:10 +020026 /* Relocated at runtime in cbmem so the address does not matter. */
27 RAMSTAGE(64M, 8M)
Aaron Durbin956c4f22015-09-05 13:31:14 -050028
Arthur Heymansa2bc2542021-05-29 08:10:49 +020029#elif ENV_SEPARATE_ROMSTAGE
Aaron Durbin294ce852015-09-15 17:04:13 -050030 /* The 1M size is not allocated. It's just for basic size checking.
31 * Link at 32MiB address and rely on cbfstool to relocate to XIP. */
Andrey Petrovccd300b2016-02-28 22:04:51 -080032 ROMSTAGE(CONFIG_ROMSTAGE_ADDR, 1M)
Aaron Durbin956c4f22015-09-05 13:31:14 -050033
Arthur Heymans28de28d2022-05-15 21:46:44 +020034 INCLUDE "romstage/arch/x86/car.ld"
Julius Werner21a40532020-04-21 16:03:53 -070035#elif ENV_SEPARATE_VERSTAGE
Aaron Durbin75c51d92015-09-29 16:31:20 -050036 /* The 1M size is not allocated. It's just for basic size checking.
37 * Link at 32MiB address and rely on cbfstool to relocate to XIP. */
Andrey Petrovccd300b2016-02-28 22:04:51 -080038 VERSTAGE(CONFIG_VERSTAGE_ADDR, 1M)
Aaron Durbin75c51d92015-09-29 16:31:20 -050039
Arthur Heymans28de28d2022-05-15 21:46:44 +020040 INCLUDE "verstage/arch/x86/car.ld"
Aaron Durbineb907b32016-01-21 00:08:17 -060041#elif ENV_BOOTBLOCK
Aaron Durbineb907b32016-01-21 00:08:17 -060042
Arthur Heymans28de28d2022-05-15 21:46:44 +020043 INCLUDE "bootblock/arch/x86/car.ld"
Aaron Durbineb907b32016-01-21 00:08:17 -060044
Aaron Durbin7f8afe02016-03-18 12:21:23 -050045#elif ENV_POSTCAR
46 POSTCAR(32M, 1M)
Aaron Durbin956c4f22015-09-05 13:31:14 -050047#endif
48}