1/* SPDX-License-Identifier: GPL-2.0-only */ 2 3gdtptr_offset = gdtptr & 0xffff; 4nullidt_offset = nullidt & 0xffff; 5 6/* Symbol _start16bit must be aligned to 4kB to start AP CPUs with 7 * Startup IPI message without RAM. 8 */ 9#if CONFIG(SIPI_VECTOR_IN_ROM) 10_bogus = ASSERT((_start16bit & 0xfff) == 0, "Symbol _start16bit is not at 4 KiB boundary"); 11ap_sipi_vector_in_rom = (_start16bit >> 12) & 0xff; 12#endif 13 14SECTIONS { 15 16#if CONFIG(FIXED_BOOTBLOCK_SIZE) 17 . = _ebootblock - CONFIG_C_ENV_BOOTBLOCK_SIZE; 18#else 19 . = BOOTBLOCK_TOP - PROGRAM_SZ; 20 /* Page tables need to be at a 4K boundary so align the bootblock downwards */ 21 . = ALIGN(4096); 22 . -= 4096; 23#endif 24 25 _bootblock = .; 26 27 INCLUDE "bootblock/lib/program.ld" 28 29 PROGRAM_SZ = SIZEOF(.text) + SIZEOF(.data) + CONFIG_X86_BOOTBLOCK_EXTRA_PROGRAM_SZ; 30 31 . = MIN(_ECFW_PTR, MIN(_ID_SECTION, _FIT_POINTER)) - EARLYASM_SZ; 32 . = CONFIG(SIPI_VECTOR_IN_ROM) ? ALIGN(4096) : ALIGN(16); 33 BOOTBLOCK_TOP = .; 34 .init (.) : { 35 *(.init._start); 36 *(.init); 37 *(.init.*); 38 } 39 40 /* 41 * Allocation reserves extra space here. Alignment requirements 42 * may cause the total size of a section to change when the start 43 * address gets applied. 44 */ 45 EARLYASM_SZ = SIZEOF(.init) + (CONFIG(SIPI_VECTOR_IN_ROM) ? 4096 : 16); 46 47 . = _ID_SECTION; 48 .id (.): { 49 KEEP(*(.id)); 50 } 51 52 /* Flashrom and FILO have two alternatives for the location of .id section. */ 53 _ID_SECTION_END = SIZEOF(.fit_pointer) && SIZEOF(.id) > 0x28 ? 0xffffff80 : _X86_RESET_VECTOR; 54 _ID_SECTION = _ID_SECTION_END - SIZEOF(.id); 55 56 . = _ECFW_PTR; 57 .ecfw_ptr (.): { 58 ASSERT((SIZEOF(.ecfw_ptr) == CONFIG_ECFW_PTR_SIZE), "Size of ecfw_ptr is incorrect"); 59 KEEP(*(.ecfw_ptr)); 60 } 61 _ECFW_PTR = SIZEOF(.ecfw_ptr) ? CONFIG_ECFW_PTR_ADDR : _X86_RESET_VECTOR; 62 63 . = _FIT_POINTER; 64 .fit_pointer (.): { 65 KEEP(*(.fit_pointer)); 66 } 67 _FIT_POINTER = SIZEOF(.fit_pointer) ? 0xffffffc0 : _X86_RESET_VECTOR; 68 69 . = 0xfffffff0; 70 _X86_RESET_VECTOR = .; 71 .reset . : { 72 *(.reset); 73 . = _X86_RESET_VECTOR_FILLING; 74 BYTE(0); 75 } 76 . = 0xfffffffc; 77 .header_pointer . : { 78 KEEP(*(.header_pointer)); 79 } 80 _X86_RESET_VECTOR_FILLING = 15 - SIZEOF(.header_pointer); 81 _ebootblock = .; 82} 83 84/* 85 * Tests _bogus1 and _bogus2 are here to detect case of symbol addresses truncated 86 * to 32 bits and intermediate files reaching size of close to 4 GiB. 87 */ 88_bogus1 = ASSERT(_bootblock & 0x80000000, "_bootblock too low, invalid ld script"); 89_bogus2 = ASSERT(_start16bit & 0x80000000, "_start16bit too low, invalid ld script"); 90_bogus3 = ASSERT(_start16bit >= 0xffff0000, "_start16bit too low. Please report."); 91_bogus4 = ASSERT(_ebootblock - _bootblock <= CONFIG_C_ENV_BOOTBLOCK_SIZE, 92 "_bootblock too low, increase C_ENV_BOOTBLOCK_SIZE"); 93