Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Memory map: |
| 3 | * |
Stefan Reinauer | 7925384 | 2010-04-13 13:43:35 +0000 | [diff] [blame] | 4 | * CONFIG_RAMBASE : text segment |
| 5 | * : rodata segment |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 6 | * : data segment |
| 7 | * : bss segment |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 8 | * : stack |
Stefan Reinauer | 7925384 | 2010-04-13 13:43:35 +0000 | [diff] [blame] | 9 | * : heap |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 10 | */ |
| 11 | /* |
| 12 | * Bootstrap code for the STPC Consumer |
| 13 | * Copyright (c) 1999 by Net Insight AB. All Rights Reserved. |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 14 | */ |
| 15 | |
| 16 | /* |
| 17 | * Written by Johan Rydberg, based on work by Daniel Kahlin. |
| 18 | * Rewritten by Eric Biederman |
Stefan Reinauer | f8ee180 | 2008-01-18 15:08:58 +0000 | [diff] [blame] | 19 | * 2005.12 yhlu add coreboot_ram cross the vga font buffer handling |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 20 | */ |
Stefan Reinauer | 7925384 | 2010-04-13 13:43:35 +0000 | [diff] [blame] | 21 | |
| 22 | /* We use ELF as output format. So that we can debug the code in some form. */ |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 23 | INCLUDE ldoptions |
| 24 | |
| 25 | ENTRY(_start) |
| 26 | |
| 27 | SECTIONS |
| 28 | { |
Stefan Reinauer | 0867062 | 2009-06-30 15:17:49 +0000 | [diff] [blame] | 29 | . = CONFIG_RAMBASE; |
Stefan Reinauer | 7925384 | 2010-04-13 13:43:35 +0000 | [diff] [blame] | 30 | /* First we place the code and read only data (typically const declared). |
| 31 | * This could theoretically be placed in rom. |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 32 | */ |
| 33 | .text : { |
| 34 | _text = .; |
| 35 | *(.text); |
| 36 | *(.text.*); |
| 37 | . = ALIGN(16); |
| 38 | _etext = .; |
| 39 | } |
Stefan Reinauer | 7925384 | 2010-04-13 13:43:35 +0000 | [diff] [blame] | 40 | |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 41 | .rodata : { |
| 42 | _rodata = .; |
| 43 | . = ALIGN(4); |
| 44 | console_drivers = .; |
| 45 | *(.rodata.console_drivers) |
| 46 | econsole_drivers = . ; |
| 47 | . = ALIGN(4); |
| 48 | pci_drivers = . ; |
Eric Biederman | 5899fd8 | 2003-04-24 06:25:08 +0000 | [diff] [blame] | 49 | *(.rodata.pci_driver) |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 50 | epci_drivers = . ; |
Eric Biederman | b78c197 | 2004-10-14 20:54:17 +0000 | [diff] [blame] | 51 | cpu_drivers = . ; |
| 52 | *(.rodata.cpu_driver) |
| 53 | ecpu_drivers = . ; |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 54 | *(.rodata) |
| 55 | *(.rodata.*) |
Stefan Reinauer | 7925384 | 2010-04-13 13:43:35 +0000 | [diff] [blame] | 56 | /* kevinh/Ispiri - Added an align, because the objcopy tool |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 57 | * incorrectly converts sections that are not long word aligned. |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 58 | */ |
| 59 | . = ALIGN(4); |
| 60 | |
| 61 | _erodata = .; |
Stefan Reinauer | 14e2277 | 2010-04-27 06:56:47 +0000 | [diff] [blame] | 62 | } |
Stefan Reinauer | 7925384 | 2010-04-13 13:43:35 +0000 | [diff] [blame] | 63 | /* After the code we place initialized data (typically initialized |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 64 | * 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 Reinauer | b743885 | 2009-03-17 15:15:15 +0000 | [diff] [blame] | 74 | |
Stefan Reinauer | 7925384 | 2010-04-13 13:43:35 +0000 | [diff] [blame] | 75 | /* bss does not contain data, it is just a space that should be zero |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 76 | * 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 Reinauer | 7925384 | 2010-04-13 13:43:35 +0000 | [diff] [blame] | 87 | |
| 88 | /* coreboot really "ends" here. Only heap and stack are placed after |
| 89 | * this line. |
| 90 | */ |
| 91 | |
Stefan Reinauer | 0867062 | 2009-06-30 15:17:49 +0000 | [diff] [blame] | 92 | . = ALIGN(CONFIG_STACK_SIZE); |
Patrick Georgi | 9d24c7f | 2010-03-01 17:16:06 +0000 | [diff] [blame] | 93 | |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 94 | _stack = .; |
| 95 | .stack . : { |
Eric Biederman | b78c197 | 2004-10-14 20:54:17 +0000 | [diff] [blame] | 96 | /* Reserve a stack for each possible cpu */ |
Patrick Georgi | 9d24c7f | 2010-03-01 17:16:06 +0000 | [diff] [blame] | 97 | . += CONFIG_MAX_CPUS*CONFIG_STACK_SIZE; |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 98 | } |
| 99 | _estack = .; |
Stefan Reinauer | 7925384 | 2010-04-13 13:43:35 +0000 | [diff] [blame] | 100 | |
Yinghai Lu | 72ee9b0 | 2005-12-14 02:39:33 +0000 | [diff] [blame] | 101 | _heap = .; |
| 102 | .heap . : { |
Stefan Reinauer | 0867062 | 2009-06-30 15:17:49 +0000 | [diff] [blame] | 103 | /* Reserve CONFIG_HEAP_SIZE bytes for the heap */ |
| 104 | . = CONFIG_HEAP_SIZE ; |
Yinghai Lu | 72ee9b0 | 2005-12-14 02:39:33 +0000 | [diff] [blame] | 105 | . = ALIGN(4); |
| 106 | } |
| 107 | _eheap = .; |
Patrick Georgi | 9d24c7f | 2010-03-01 17:16:06 +0000 | [diff] [blame] | 108 | |
Stefan Reinauer | 14e2277 | 2010-04-27 06:56:47 +0000 | [diff] [blame] | 109 | /* The ram segment. This includes all memory used by the memory |
Stefan Reinauer | 7925384 | 2010-04-13 13:43:35 +0000 | [diff] [blame] | 110 | * resident copy of coreboot, except the tables that are produced on |
| 111 | * the fly, but including stack and heap. |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 112 | */ |
Stefan Reinauer | 14e2277 | 2010-04-27 06:56:47 +0000 | [diff] [blame] | 113 | _ram_seg = _text; |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 114 | _eram_seg = _eheap; |
Yinghai Lu | 72ee9b0 | 2005-12-14 02:39:33 +0000 | [diff] [blame] | 115 | |
Stefan Reinauer | 7925384 | 2010-04-13 13:43:35 +0000 | [diff] [blame] | 116 | /* 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 Lu | 0571a95 | 2006-01-04 20:42:49 +0000 | [diff] [blame] | 120 | |
Stefan Reinauer | 7925384 | 2010-04-13 13:43:35 +0000 | [diff] [blame] | 121 | /* Discard the sections we don't need/want */ |
Yinghai Lu | 0571a95 | 2006-01-04 20:42:49 +0000 | [diff] [blame] | 122 | |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 123 | /DISCARD/ : { |
| 124 | *(.comment) |
| 125 | *(.note) |
Eric Biederman | b78c197 | 2004-10-14 20:54:17 +0000 | [diff] [blame] | 126 | *(.note.*) |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 127 | } |
| 128 | } |