Aaron Durbin | 956c4f2 | 2015-09-05 13:31:14 -0500 | [diff] [blame] | 1 | /* |
| 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 Durbin | 956c4f2 | 2015-09-05 13:31:14 -0500 | [diff] [blame] | 16 | */ |
| 17 | |
| 18 | /* This file is included inside a SECTIONS block */ |
| 19 | . = CONFIG_DCACHE_RAM_BASE; |
| 20 | .car.data . (NOLOAD) : { |
Andrey Petrov | dd56de9 | 2016-02-25 17:22:17 -0800 | [diff] [blame] | 21 | _car_region_start = . ; |
Julius Werner | cd49cce | 2019-03-05 16:53:33 -0800 | [diff] [blame] | 22 | #if CONFIG(PAGING_IN_CACHE_AS_RAM) |
Aaron Durbin | 0f35af8f | 2018-04-18 01:00:27 -0600 | [diff] [blame] | 23 | /* 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 Kitching | d6f71d0 | 2019-02-21 12:37:55 +0800 | [diff] [blame] | 29 | /* Vboot work buffer only needs to be available when verified boot |
| 30 | * starts in bootblock. */ |
Julius Werner | cd49cce | 2019-03-05 16:53:33 -0800 | [diff] [blame] | 31 | #if CONFIG(VBOOT_STARTS_IN_BOOTBLOCK) |
Joel Kitching | 0097f55 | 2019-02-21 12:36:55 +0800 | [diff] [blame] | 32 | VBOOT2_WORK(., 12K) |
Aaron Durbin | 75c51d9 | 2015-09-29 16:31:20 -0500 | [diff] [blame] | 33 | #endif |
Philipp Deppenwiese | c9b7d1f | 2018-11-10 00:35:02 +0100 | [diff] [blame] | 34 | /* Vboot measured boot TCPA log measurements. |
| 35 | * Needs to be transferred until CBMEM is available |
| 36 | */ |
Arthur Heymans | 3c61304 | 2019-04-21 23:59:47 +0200 | [diff] [blame^] | 37 | #if CONFIG(VBOOT_MEASURED_BOOT) |
Philipp Deppenwiese | c9b7d1f | 2018-11-10 00:35:02 +0100 | [diff] [blame] | 38 | VBOOT2_TPM_LOG(., 2K) |
Arthur Heymans | 3c61304 | 2019-04-21 23:59:47 +0200 | [diff] [blame^] | 39 | #endif |
Andrey Petrov | ee9e4ae | 2016-02-08 17:17:05 -0800 | [diff] [blame] | 40 | /* Stack for CAR stages. Since it persists across all stages that |
| 41 | * use CAR it can be reused. The chipset/SoC is expected to provide |
| 42 | * the stack size. */ |
Julius Werner | cd49cce | 2019-03-05 16:53:33 -0800 | [diff] [blame] | 43 | #if CONFIG(C_ENVIRONMENT_BOOTBLOCK) |
Andrey Petrov | ee9e4ae | 2016-02-08 17:17:05 -0800 | [diff] [blame] | 44 | _car_stack_start = .; |
| 45 | . += CONFIG_DCACHE_BSP_STACK_SIZE; |
| 46 | _car_stack_end = .; |
| 47 | #endif |
Aaron Durbin | dd6fa93 | 2015-09-24 12:18:07 -0500 | [diff] [blame] | 48 | /* The pre-ram cbmem console as well as the timestamp region are fixed |
Arthur Heymans | 4cc9b6c | 2018-12-28 17:53:36 +0100 | [diff] [blame] | 49 | * in size. Therefore place them above the car global section so that |
| 50 | * multiple stages (romstage and verstage) have a consistent |
| 51 | * link address of these shared objects. */ |
Kyösti Mälkki | 513a1a8 | 2018-06-03 12:29:50 +0300 | [diff] [blame] | 52 | PRERAM_CBMEM_CONSOLE(., CONFIG_PRERAM_CBMEM_CONSOLE_SIZE) |
Julius Werner | cd49cce | 2019-03-05 16:53:33 -0800 | [diff] [blame] | 53 | #if CONFIG(PAGING_IN_CACHE_AS_RAM) |
Aaron Durbin | 0f35af8f | 2018-04-18 01:00:27 -0600 | [diff] [blame] | 54 | . = ALIGN(32); |
| 55 | /* Page directory pointer table resides here. There are 4 8-byte entries |
| 56 | * totalling 32 bytes that need to be 32-byte aligned. The reason the |
| 57 | * pdpt are not colocated with the rest of the page tables is to reduce |
| 58 | * fragmentation of the CAR space that persists across stages. */ |
| 59 | _pdpt = .; |
| 60 | . += 32; |
| 61 | _epdpt = .; |
| 62 | #endif |
Andrey Petrov | dd56de9 | 2016-02-25 17:22:17 -0800 | [diff] [blame] | 63 | _car_relocatable_data_start = .; |
Aaron Durbin | dd6fa93 | 2015-09-24 12:18:07 -0500 | [diff] [blame] | 64 | /* The timestamp implementation relies on this storage to be around |
| 65 | * after migration. One of the fields indicates not to use it as the |
| 66 | * backing store once cbmem comes online. Therefore, this data needs |
Andrey Petrov | dd56de9 | 2016-02-25 17:22:17 -0800 | [diff] [blame] | 67 | * to reside in the migrated area (between _car_relocatable_data_start |
| 68 | * and _car_relocatable_data_end). */ |
Furquan Shaikh | 549080b | 2018-05-17 23:30:28 -0700 | [diff] [blame] | 69 | TIMESTAMP(., 0x200) |
Arthur Heymans | 4cc9b6c | 2018-12-28 17:53:36 +0100 | [diff] [blame] | 70 | _car_ehci_dbg_info_start = .; |
Kyösti Mälkki | f88208e | 2019-01-31 08:29:32 +0200 | [diff] [blame] | 71 | /* Reserve sizeof(struct ehci_dbg_info). */ |
Kyösti Mälkki | 45ad4f0 | 2019-01-31 19:24:04 +0200 | [diff] [blame] | 72 | . += 80; |
Arthur Heymans | 4cc9b6c | 2018-12-28 17:53:36 +0100 | [diff] [blame] | 73 | _car_ehci_dbg_info_end = .; |
Aaron Durbin | dd6fa93 | 2015-09-24 12:18:07 -0500 | [diff] [blame] | 74 | /* _car_global_start and _car_global_end provide symbols to per-stage |
| 75 | * variables that are not shared like the timestamp and the pre-ram |
| 76 | * cbmem console. This is useful for clearing this area on a per-stage |
| 77 | * basis when more than one stage uses cache-as-ram for CAR_GLOBALs. */ |
| 78 | _car_global_start = .; |
Julius Werner | cd49cce | 2019-03-05 16:53:33 -0800 | [diff] [blame] | 79 | #if CONFIG(NO_CAR_GLOBAL_MIGRATION) |
Aaron Durbin | 76ab2b7 | 2018-10-30 12:15:10 -0600 | [diff] [blame] | 80 | /* Allow global unitialized variables when CAR_GLOBALs are not used. */ |
| 81 | *(.bss) |
| 82 | *(.bss.*) |
| 83 | *(.sbss) |
| 84 | *(.sbss.*) |
| 85 | #else |
| 86 | /* .car.global_data objects only around when |
| 87 | * !CONFIG_NO_CAR_GLOBAL_MIGRATION is employed. */ |
Aaron Durbin | 956c4f2 | 2015-09-05 13:31:14 -0500 | [diff] [blame] | 88 | *(.car.global_data); |
Aaron Durbin | 76ab2b7 | 2018-10-30 12:15:10 -0600 | [diff] [blame] | 89 | #endif |
Aaron Durbin | 956c4f2 | 2015-09-05 13:31:14 -0500 | [diff] [blame] | 90 | . = ALIGN(ARCH_POINTER_ALIGN_SIZE); |
Aaron Durbin | dd6fa93 | 2015-09-24 12:18:07 -0500 | [diff] [blame] | 91 | _car_global_end = .; |
Andrey Petrov | dd56de9 | 2016-02-25 17:22:17 -0800 | [diff] [blame] | 92 | _car_relocatable_data_end = .; |
| 93 | |
Arthur Heymans | c94ba79 | 2019-04-22 00:25:05 +0200 | [diff] [blame] | 94 | #if (CONFIG(NORTHBRIDGE_INTEL_SANDYBRIDGE) || \ |
| 95 | CONFIG(NORTHBRIDGE_INTEL_IVYBRIDGE)) && \ |
Julius Werner | cd49cce | 2019-03-05 16:53:33 -0800 | [diff] [blame] | 96 | !CONFIG(USE_NATIVE_RAMINIT) |
Kyösti Mälkki | b697c90 | 2019-01-30 08:19:49 +0200 | [diff] [blame] | 97 | . = ABSOLUTE(0xff7e1000); |
| 98 | _mrc_pool = .; |
| 99 | . += 0x5000; |
| 100 | _emrc_pool = .; |
| 101 | #endif |
| 102 | |
Julius Werner | cd49cce | 2019-03-05 16:53:33 -0800 | [diff] [blame] | 103 | #if !CONFIG(C_ENVIRONMENT_BOOTBLOCK) |
Kyösti Mälkki | d7892bc | 2018-12-28 19:18:46 +0200 | [diff] [blame] | 104 | _car_stack_start = .; |
| 105 | _car_stack_end = _car_region_end; |
| 106 | #endif |
Andrey Petrov | dd56de9 | 2016-02-25 17:22:17 -0800 | [diff] [blame] | 107 | _car_region_end = . + CONFIG_DCACHE_RAM_SIZE - (. - _car_region_start); |
Aaron Durbin | 956c4f2 | 2015-09-05 13:31:14 -0500 | [diff] [blame] | 108 | } |
| 109 | |
| 110 | /* Global variables are not allowed in romstage |
| 111 | * This section is checked during stage creation to ensure |
| 112 | * that there are no global variables present |
| 113 | */ |
| 114 | |
| 115 | . = 0xffffff00; |
| 116 | .illegal_globals . : { |
Nico Huber | 98fc426 | 2016-01-23 01:24:33 +0100 | [diff] [blame] | 117 | *(EXCLUDE_FILE ("*/libagesa.*.a:" "*/romstage*/buildOpts.o" "*/romstage*/agesawrapper.o" "*/vendorcode/amd/agesa/*" "*/vendorcode/amd/cimx/*") .data) |
| 118 | *(EXCLUDE_FILE ("*/libagesa.*.a:" "*/romstage*/buildOpts.o" "*/romstage*/agesawrapper.o" "*/vendorcode/amd/agesa/*" "*/vendorcode/amd/cimx/*") .data.*) |
Julius Werner | cd49cce | 2019-03-05 16:53:33 -0800 | [diff] [blame] | 119 | #if !CONFIG(NO_CAR_GLOBAL_MIGRATION) |
Aaron Durbin | 956c4f2 | 2015-09-05 13:31:14 -0500 | [diff] [blame] | 120 | *(.bss) |
| 121 | *(.bss.*) |
| 122 | *(.sbss) |
| 123 | *(.sbss.*) |
Aaron Durbin | 76ab2b7 | 2018-10-30 12:15:10 -0600 | [diff] [blame] | 124 | #else |
| 125 | /* In case something sneaks through when it shouldn't. */ |
| 126 | *(.car.global_data); |
| 127 | #endif |
Aaron Durbin | 956c4f2 | 2015-09-05 13:31:14 -0500 | [diff] [blame] | 128 | } |
| 129 | |
Aaron Durbin | dd6fa93 | 2015-09-24 12:18:07 -0500 | [diff] [blame] | 130 | _bogus = ASSERT((CONFIG_DCACHE_RAM_SIZE == 0) || (SIZEOF(.car.data) <= CONFIG_DCACHE_RAM_SIZE), "Cache as RAM area is too full"); |
Julius Werner | cd49cce | 2019-03-05 16:53:33 -0800 | [diff] [blame] | 131 | #if CONFIG(PAGING_IN_CACHE_AS_RAM) |
Aaron Durbin | 0f35af8f | 2018-04-18 01:00:27 -0600 | [diff] [blame] | 132 | _bogus2 = ASSERT(_pagetables == ALIGN(_pagetables, 4096), "_pagetables aren't 4KiB aligned"); |
| 133 | #endif |
Julius Werner | cd49cce | 2019-03-05 16:53:33 -0800 | [diff] [blame] | 134 | #if CONFIG(C_ENVIRONMENT_BOOTBLOCK) |
Patrick Rudolph | d72d52a | 2018-11-12 19:26:54 +0100 | [diff] [blame] | 135 | _bogus3 = ASSERT(CONFIG_DCACHE_BSP_STACK_SIZE > 0x0, "BSP stack size not configured"); |
| 136 | #endif |