blob: 57ddd03c0dcead8eba64d5c1812b60333e9c328c [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
Stefan Reinauerf8ee1802008-01-18 15:08:58 +000019 * 2005.12 yhlu add coreboot_ram 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 = .;
35 *(.text);
36 *(.text.*);
37 . = ALIGN(16);
38 _etext = .;
39 }
Stefan Reinauer79253842010-04-13 13:43:35 +000040
Eric Biederman8ca8d762003-04-22 19:02:15 +000041 .rodata : {
42 _rodata = .;
43 . = ALIGN(4);
44 console_drivers = .;
45 *(.rodata.console_drivers)
46 econsole_drivers = . ;
47 . = ALIGN(4);
48 pci_drivers = . ;
Eric Biederman5899fd82003-04-24 06:25:08 +000049 *(.rodata.pci_driver)
Eric Biederman8ca8d762003-04-22 19:02:15 +000050 epci_drivers = . ;
Eric Biedermanb78c1972004-10-14 20:54:17 +000051 cpu_drivers = . ;
52 *(.rodata.cpu_driver)
53 ecpu_drivers = . ;
Eric Biederman8ca8d762003-04-22 19:02:15 +000054 *(.rodata)
55 *(.rodata.*)
Stefan Reinauer79253842010-04-13 13:43:35 +000056 /* kevinh/Ispiri - Added an align, because the objcopy tool
Eric Biederman8ca8d762003-04-22 19:02:15 +000057 * incorrectly converts sections that are not long word aligned.
Eric Biederman8ca8d762003-04-22 19:02:15 +000058 */
59 . = ALIGN(4);
60
61 _erodata = .;
Stefan Reinauer14e22772010-04-27 06:56:47 +000062 }
Stefan Reinauer79253842010-04-13 13:43:35 +000063 /* After the code we place initialized data (typically initialized
Eric Biederman8ca8d762003-04-22 19:02:15 +000064 * global variables). This gets copied into ram by startup code.
65 * __data_start and __data_end shows where in ram this should be placed,
66 * whereas __data_loadstart and __data_loadend shows where in rom to
67 * copy from.
68 */
69 .data : {
70 _data = .;
71 *(.data)
72 _edata = .;
73 }
Stefan Reinauerb7438852009-03-17 15:15:15 +000074
Stefan Reinauer79253842010-04-13 13:43:35 +000075 /* bss does not contain data, it is just a space that should be zero
Eric Biederman8ca8d762003-04-22 19:02:15 +000076 * initialized on startup. (typically uninitialized global variables)
77 * crt0.S fills between _bss and _ebss with zeroes.
78 */
79 _bss = .;
80 .bss . : {
81 *(.bss)
82 *(.sbss)
83 *(COMMON)
84 }
85 _ebss = .;
86 _end = .;
Stefan Reinauer79253842010-04-13 13:43:35 +000087
88 /* coreboot really "ends" here. Only heap and stack are placed after
89 * this line.
90 */
91
Stefan Reinauer08670622009-06-30 15:17:49 +000092 . = ALIGN(CONFIG_STACK_SIZE);
Patrick Georgi9d24c7f2010-03-01 17:16:06 +000093
Eric Biederman8ca8d762003-04-22 19:02:15 +000094 _stack = .;
95 .stack . : {
Eric Biedermanb78c1972004-10-14 20:54:17 +000096 /* Reserve a stack for each possible cpu */
Patrick Georgi9d24c7f2010-03-01 17:16:06 +000097 . += CONFIG_MAX_CPUS*CONFIG_STACK_SIZE;
Eric Biederman8ca8d762003-04-22 19:02:15 +000098 }
99 _estack = .;
Stefan Reinauer79253842010-04-13 13:43:35 +0000100
Yinghai Lu72ee9b02005-12-14 02:39:33 +0000101 _heap = .;
102 .heap . : {
Stefan Reinauer08670622009-06-30 15:17:49 +0000103 /* Reserve CONFIG_HEAP_SIZE bytes for the heap */
104 . = CONFIG_HEAP_SIZE ;
Yinghai Lu72ee9b02005-12-14 02:39:33 +0000105 . = ALIGN(4);
106 }
107 _eheap = .;
Patrick Georgi9d24c7f2010-03-01 17:16:06 +0000108
Stefan Reinauer14e22772010-04-27 06:56:47 +0000109 /* The ram segment. This includes all memory used by the memory
Stefan Reinauer79253842010-04-13 13:43:35 +0000110 * resident copy of coreboot, except the tables that are produced on
111 * the fly, but including stack and heap.
Eric Biederman8ca8d762003-04-22 19:02:15 +0000112 */
Stefan Reinauer14e22772010-04-27 06:56:47 +0000113 _ram_seg = _text;
Eric Biederman8ca8d762003-04-22 19:02:15 +0000114 _eram_seg = _eheap;
Yinghai Lu72ee9b02005-12-14 02:39:33 +0000115
Stefan Reinauer79253842010-04-13 13:43:35 +0000116 /* CONFIG_RAMTOP is the upper address of cached memory (among other
117 * things). We must not exceed beyond that address, there be dragons.
118 */
119 _bogus = ASSERT( ( _eram_seg < (CONFIG_RAMTOP)) , "Please increase CONFIG_RAMTOP");
Yinghai Lu0571a952006-01-04 20:42:49 +0000120
Stefan Reinauer79253842010-04-13 13:43:35 +0000121 /* Discard the sections we don't need/want */
Yinghai Lu0571a952006-01-04 20:42:49 +0000122
Eric Biederman8ca8d762003-04-22 19:02:15 +0000123 /DISCARD/ : {
124 *(.comment)
125 *(.note)
Eric Biedermanb78c1972004-10-14 20:54:17 +0000126 *(.note.*)
Eric Biederman8ca8d762003-04-22 19:02:15 +0000127 }
128}