blob: d97df19a3766cc749e89cf01635f863e59ebfeb5 [file] [log] [blame]
Aaron Durbin956c4f22015-09-05 13:31:14 -05001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2006 Advanced Micro Devices, Inc.
5 * Copyright (C) 2008-2010 coresystems GmbH
6 * Copyright 2015 Google Inc
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; version 2 of the License.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
Aaron Durbin956c4f22015-09-05 13:31:14 -050016 */
17
18/* This file is included inside a SECTIONS block */
19. = CONFIG_DCACHE_RAM_BASE;
20.car.data . (NOLOAD) : {
Andrey Petrovdd56de92016-02-25 17:22:17 -080021 _car_region_start = . ;
Julius Wernercd49cce2019-03-05 16:53:33 -080022#if CONFIG(PAGING_IN_CACHE_AS_RAM)
Aaron Durbin0f35af8f2018-04-18 01:00:27 -060023 /* Page table pre-allocation. CONFIG_DCACHE_RAM_BASE should be 4KiB
24 * aligned when using this option. */
25 _pagetables = . ;
26 . += 4096 * CONFIG_NUM_CAR_PAGE_TABLE_PAGES;
27 _epagetables = . ;
28#endif
Joel Kitchingd6f71d02019-02-21 12:37:55 +080029 /* Vboot work buffer only needs to be available when verified boot
30 * starts in bootblock. */
Julius Wernercd49cce2019-03-05 16:53:33 -080031#if CONFIG(VBOOT_STARTS_IN_BOOTBLOCK)
Joel Kitching0097f552019-02-21 12:36:55 +080032 VBOOT2_WORK(., 12K)
Aaron Durbin75c51d92015-09-29 16:31:20 -050033#endif
Philipp Deppenwiesec9b7d1f2018-11-10 00:35:02 +010034 /* Vboot measured boot TCPA log measurements.
35 * Needs to be transferred until CBMEM is available
36 */
37 VBOOT2_TPM_LOG(., 2K)
Andrey Petrovee9e4ae2016-02-08 17:17:05 -080038 /* Stack for CAR stages. Since it persists across all stages that
39 * use CAR it can be reused. The chipset/SoC is expected to provide
40 * the stack size. */
Julius Wernercd49cce2019-03-05 16:53:33 -080041#if CONFIG(C_ENVIRONMENT_BOOTBLOCK)
Andrey Petrovee9e4ae2016-02-08 17:17:05 -080042 _car_stack_start = .;
43 . += CONFIG_DCACHE_BSP_STACK_SIZE;
44 _car_stack_end = .;
45#endif
Aaron Durbindd6fa932015-09-24 12:18:07 -050046 /* The pre-ram cbmem console as well as the timestamp region are fixed
Arthur Heymans4cc9b6c2018-12-28 17:53:36 +010047 * in size. Therefore place them above the car global section so that
48 * multiple stages (romstage and verstage) have a consistent
49 * link address of these shared objects. */
Kyösti Mälkki513a1a82018-06-03 12:29:50 +030050 PRERAM_CBMEM_CONSOLE(., CONFIG_PRERAM_CBMEM_CONSOLE_SIZE)
Julius Wernercd49cce2019-03-05 16:53:33 -080051#if CONFIG(PAGING_IN_CACHE_AS_RAM)
Aaron Durbin0f35af8f2018-04-18 01:00:27 -060052 . = ALIGN(32);
53 /* Page directory pointer table resides here. There are 4 8-byte entries
54 * totalling 32 bytes that need to be 32-byte aligned. The reason the
55 * pdpt are not colocated with the rest of the page tables is to reduce
56 * fragmentation of the CAR space that persists across stages. */
57 _pdpt = .;
58 . += 32;
59 _epdpt = .;
60#endif
Andrey Petrovdd56de92016-02-25 17:22:17 -080061 _car_relocatable_data_start = .;
Aaron Durbindd6fa932015-09-24 12:18:07 -050062 /* The timestamp implementation relies on this storage to be around
63 * after migration. One of the fields indicates not to use it as the
64 * backing store once cbmem comes online. Therefore, this data needs
Andrey Petrovdd56de92016-02-25 17:22:17 -080065 * to reside in the migrated area (between _car_relocatable_data_start
66 * and _car_relocatable_data_end). */
Furquan Shaikh549080b2018-05-17 23:30:28 -070067 TIMESTAMP(., 0x200)
Arthur Heymans4cc9b6c2018-12-28 17:53:36 +010068 _car_ehci_dbg_info_start = .;
Kyösti Mälkkif88208e2019-01-31 08:29:32 +020069 /* Reserve sizeof(struct ehci_dbg_info). */
Kyösti Mälkki45ad4f02019-01-31 19:24:04 +020070 . += 80;
Arthur Heymans4cc9b6c2018-12-28 17:53:36 +010071 _car_ehci_dbg_info_end = .;
Aaron Durbindd6fa932015-09-24 12:18:07 -050072 /* _car_global_start and _car_global_end provide symbols to per-stage
73 * variables that are not shared like the timestamp and the pre-ram
74 * cbmem console. This is useful for clearing this area on a per-stage
75 * basis when more than one stage uses cache-as-ram for CAR_GLOBALs. */
76 _car_global_start = .;
Julius Wernercd49cce2019-03-05 16:53:33 -080077#if CONFIG(NO_CAR_GLOBAL_MIGRATION)
Aaron Durbin76ab2b72018-10-30 12:15:10 -060078 /* Allow global unitialized variables when CAR_GLOBALs are not used. */
79 *(.bss)
80 *(.bss.*)
81 *(.sbss)
82 *(.sbss.*)
83#else
84 /* .car.global_data objects only around when
85 * !CONFIG_NO_CAR_GLOBAL_MIGRATION is employed. */
Aaron Durbin956c4f22015-09-05 13:31:14 -050086 *(.car.global_data);
Aaron Durbin76ab2b72018-10-30 12:15:10 -060087#endif
Aaron Durbin956c4f22015-09-05 13:31:14 -050088 . = ALIGN(ARCH_POINTER_ALIGN_SIZE);
Aaron Durbindd6fa932015-09-24 12:18:07 -050089 _car_global_end = .;
Andrey Petrovdd56de92016-02-25 17:22:17 -080090 _car_relocatable_data_end = .;
91
Arthur Heymansc94ba792019-04-22 00:25:05 +020092#if (CONFIG(NORTHBRIDGE_INTEL_SANDYBRIDGE) || \
93 CONFIG(NORTHBRIDGE_INTEL_IVYBRIDGE)) && \
Julius Wernercd49cce2019-03-05 16:53:33 -080094 !CONFIG(USE_NATIVE_RAMINIT)
Kyösti Mälkkib697c902019-01-30 08:19:49 +020095 . = ABSOLUTE(0xff7e1000);
96 _mrc_pool = .;
97 . += 0x5000;
98 _emrc_pool = .;
99#endif
100
Julius Wernercd49cce2019-03-05 16:53:33 -0800101#if !CONFIG(C_ENVIRONMENT_BOOTBLOCK)
Kyösti Mälkkid7892bc2018-12-28 19:18:46 +0200102 _car_stack_start = .;
103 _car_stack_end = _car_region_end;
104#endif
Andrey Petrovdd56de92016-02-25 17:22:17 -0800105 _car_region_end = . + CONFIG_DCACHE_RAM_SIZE - (. - _car_region_start);
Aaron Durbin956c4f22015-09-05 13:31:14 -0500106}
107
108/* Global variables are not allowed in romstage
109 * This section is checked during stage creation to ensure
110 * that there are no global variables present
111 */
112
113. = 0xffffff00;
114.illegal_globals . : {
Nico Huber98fc4262016-01-23 01:24:33 +0100115 *(EXCLUDE_FILE ("*/libagesa.*.a:" "*/romstage*/buildOpts.o" "*/romstage*/agesawrapper.o" "*/vendorcode/amd/agesa/*" "*/vendorcode/amd/cimx/*") .data)
116 *(EXCLUDE_FILE ("*/libagesa.*.a:" "*/romstage*/buildOpts.o" "*/romstage*/agesawrapper.o" "*/vendorcode/amd/agesa/*" "*/vendorcode/amd/cimx/*") .data.*)
Julius Wernercd49cce2019-03-05 16:53:33 -0800117#if !CONFIG(NO_CAR_GLOBAL_MIGRATION)
Aaron Durbin956c4f22015-09-05 13:31:14 -0500118 *(.bss)
119 *(.bss.*)
120 *(.sbss)
121 *(.sbss.*)
Aaron Durbin76ab2b72018-10-30 12:15:10 -0600122#else
123 /* In case something sneaks through when it shouldn't. */
124 *(.car.global_data);
125#endif
Aaron Durbin956c4f22015-09-05 13:31:14 -0500126}
127
Aaron Durbindd6fa932015-09-24 12:18:07 -0500128_bogus = ASSERT((CONFIG_DCACHE_RAM_SIZE == 0) || (SIZEOF(.car.data) <= CONFIG_DCACHE_RAM_SIZE), "Cache as RAM area is too full");
Julius Wernercd49cce2019-03-05 16:53:33 -0800129#if CONFIG(PAGING_IN_CACHE_AS_RAM)
Aaron Durbin0f35af8f2018-04-18 01:00:27 -0600130_bogus2 = ASSERT(_pagetables == ALIGN(_pagetables, 4096), "_pagetables aren't 4KiB aligned");
131#endif
Julius Wernercd49cce2019-03-05 16:53:33 -0800132#if CONFIG(C_ENVIRONMENT_BOOTBLOCK)
Patrick Rudolphd72d52a2018-11-12 19:26:54 +0100133_bogus3 = ASSERT(CONFIG_DCACHE_BSP_STACK_SIZE > 0x0, "BSP stack size not configured");
134#endif