blob: 1c8e8dcd6f6e1ee5365c8ad29281045b5b917edb [file] [log] [blame]
Eric Biederman8ca8d762003-04-22 19:02:15 +00001/*
2 * Memory map:
3 *
Stefan Reinauer79253842010-04-13 13:43:35 +00004 * CONFIG_RAMBASE : text segment
5 * : rodata segment
Eric Biederman8ca8d762003-04-22 19:02:15 +00006 * : data segment
7 * : bss segment
Eric Biederman8ca8d762003-04-22 19:02:15 +00008 * : stack
Stefan Reinauer79253842010-04-13 13:43:35 +00009 * : heap
Eric Biederman8ca8d762003-04-22 19:02:15 +000010 */
11/*
12 * Bootstrap code for the STPC Consumer
13 * Copyright (c) 1999 by Net Insight AB. All Rights Reserved.
Eric Biederman8ca8d762003-04-22 19:02:15 +000014 */
15
16/*
17 * Written by Johan Rydberg, based on work by Daniel Kahlin.
18 * Rewritten by Eric Biederman
Furquan Shaikh20f25dd2014-04-22 10:41:05 -070019 * 2005.12 yhlu add ramstage cross the vga font buffer handling
Eric Biederman8ca8d762003-04-22 19:02:15 +000020 */
Stefan Reinauer79253842010-04-13 13:43:35 +000021
22/* We use ELF as output format. So that we can debug the code in some form. */
Eric Biederman8ca8d762003-04-22 19:02:15 +000023INCLUDE ldoptions
24
25ENTRY(_start)
26
27SECTIONS
28{
Stefan Reinauer08670622009-06-30 15:17:49 +000029 . = CONFIG_RAMBASE;
Stefan Reinauer79253842010-04-13 13:43:35 +000030 /* First we place the code and read only data (typically const declared).
31 * This could theoretically be placed in rom.
Eric Biederman8ca8d762003-04-22 19:02:15 +000032 */
33 .text : {
34 _text = .;
Patrick Georgi69992172012-11-25 17:31:25 +010035 *(.textfirst);
Eric Biederman8ca8d762003-04-22 19:02:15 +000036 *(.text);
37 *(.text.*);
38 . = ALIGN(16);
39 _etext = .;
40 }
Stefan Reinauer79253842010-04-13 13:43:35 +000041
Stefan Reinauerd37ab452012-12-18 16:23:28 -080042 .ctors : {
43 . = ALIGN(0x100);
44 __CTOR_LIST__ = .;
45 *(.ctors);
46 LONG(0);
47 __CTOR_END__ = .;
48 }
49
Eric Biederman8ca8d762003-04-22 19:02:15 +000050 .rodata : {
51 _rodata = .;
52 . = ALIGN(4);
Aaron Durbinf7c6d482013-02-06 15:47:31 -060053
54 /* If any changes are made to the driver start/symbols or the
55 * section names the equivalent changes need to made to
56 * rmodule.ld. */
Eric Biederman8ca8d762003-04-22 19:02:15 +000057 pci_drivers = . ;
Eric Biederman5899fd82003-04-24 06:25:08 +000058 *(.rodata.pci_driver)
Eric Biederman8ca8d762003-04-22 19:02:15 +000059 epci_drivers = . ;
Eric Biedermanb78c1972004-10-14 20:54:17 +000060 cpu_drivers = . ;
61 *(.rodata.cpu_driver)
62 ecpu_drivers = . ;
Aaron Durbina4feddf2013-04-24 16:12:52 -050063 _bs_init_begin = .;
64 *(.bs_init)
65 _bs_init_end = .;
Aaron Durbinf7c6d482013-02-06 15:47:31 -060066
Eric Biederman8ca8d762003-04-22 19:02:15 +000067 *(.rodata)
68 *(.rodata.*)
Stefan Reinauer79253842010-04-13 13:43:35 +000069 /* kevinh/Ispiri - Added an align, because the objcopy tool
Eric Biederman8ca8d762003-04-22 19:02:15 +000070 * incorrectly converts sections that are not long word aligned.
Eric Biederman8ca8d762003-04-22 19:02:15 +000071 */
72 . = ALIGN(4);
73
74 _erodata = .;
Stefan Reinauer14e22772010-04-27 06:56:47 +000075 }
Stefan Reinauer79253842010-04-13 13:43:35 +000076 /* After the code we place initialized data (typically initialized
Eric Biederman8ca8d762003-04-22 19:02:15 +000077 * global variables). This gets copied into ram by startup code.
78 * __data_start and __data_end shows where in ram this should be placed,
79 * whereas __data_loadstart and __data_loadend shows where in rom to
80 * copy from.
81 */
82 .data : {
83 _data = .;
84 *(.data)
85 _edata = .;
86 }
Stefan Reinauerb7438852009-03-17 15:15:15 +000087
Stefan Reinauer79253842010-04-13 13:43:35 +000088 /* bss does not contain data, it is just a space that should be zero
Eric Biederman8ca8d762003-04-22 19:02:15 +000089 * initialized on startup. (typically uninitialized global variables)
90 * crt0.S fills between _bss and _ebss with zeroes.
91 */
92 _bss = .;
93 .bss . : {
94 *(.bss)
95 *(.sbss)
96 *(COMMON)
97 }
98 _ebss = .;
Stefan Reinauer79253842010-04-13 13:43:35 +000099
Yinghai Lu72ee9b02005-12-14 02:39:33 +0000100 _heap = .;
101 .heap . : {
Stefan Reinauer08670622009-06-30 15:17:49 +0000102 /* Reserve CONFIG_HEAP_SIZE bytes for the heap */
103 . = CONFIG_HEAP_SIZE ;
Yinghai Lu72ee9b02005-12-14 02:39:33 +0000104 . = ALIGN(4);
105 }
106 _eheap = .;
Patrick Georgi9d24c7f2010-03-01 17:16:06 +0000107
Stefan Reinauer14e22772010-04-27 06:56:47 +0000108 /* The ram segment. This includes all memory used by the memory
Stefan Reinauer79253842010-04-13 13:43:35 +0000109 * resident copy of coreboot, except the tables that are produced on
110 * the fly, but including stack and heap.
Eric Biederman8ca8d762003-04-22 19:02:15 +0000111 */
Stefan Reinauer14e22772010-04-27 06:56:47 +0000112 _ram_seg = _text;
Eric Biederman8ca8d762003-04-22 19:02:15 +0000113 _eram_seg = _eheap;
Yinghai Lu72ee9b02005-12-14 02:39:33 +0000114
Stefan Reinauer79253842010-04-13 13:43:35 +0000115 /* CONFIG_RAMTOP is the upper address of cached memory (among other
116 * things). We must not exceed beyond that address, there be dragons.
117 */
118 _bogus = ASSERT( ( _eram_seg < (CONFIG_RAMTOP)) , "Please increase CONFIG_RAMTOP");
Yinghai Lu0571a952006-01-04 20:42:49 +0000119
Stefan Reinauer79253842010-04-13 13:43:35 +0000120 /* Discard the sections we don't need/want */
Yinghai Lu0571a952006-01-04 20:42:49 +0000121
Eric Biederman8ca8d762003-04-22 19:02:15 +0000122 /DISCARD/ : {
123 *(.comment)
124 *(.note)
Eric Biedermanb78c1972004-10-14 20:54:17 +0000125 *(.note.*)
Eric Biederman8ca8d762003-04-22 19:02:15 +0000126 }
127}