Skip to content

Commit faa5f98

Browse files
ArthurHeymansPatrick Georgi
authored andcommitted
cpu/intel/haswell: Use the common intel romstage_main function
Tested on Google peppy (Acer C720). Change-Id: I6453c40bf4ebe4695684c1bd3a403d6def82814f Signed-off-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-on: https://review.coreboot.org/26835 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Patrick Georgi <pgeorgi@google.com> Reviewed-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
1 parent 5e2ac2c commit faa5f98

7 files changed

Lines changed: 6 additions & 54 deletions

File tree

src/cpu/intel/haswell/Makefile.inc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ ramstage-y += haswell_init.c
22
ramstage-y += tsc_freq.c
33
romstage-y += romstage.c
44
romstage-y += tsc_freq.c
5+
romstage-y += ../car/romstage.c
56

67
ramstage-y += acpi.c
78
ramstage-$(CONFIG_CACHE_RELOCATED_RAMSTAGE_OUTSIDE_CBMEM) += stage_cache.c

src/cpu/intel/haswell/haswell.h

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -163,24 +163,7 @@ struct romstage_params {
163163
unsigned long bist;
164164
void (*copy_spd)(struct pei_data *);
165165
};
166-
void mainboard_romstage_entry(unsigned long bist);
167166
void romstage_common(const struct romstage_params *params);
168-
/* romstage_main is called from the cache-as-ram assembly file. The return
169-
* value is the stack value to be used for romstage once cache-as-ram is
170-
* torn down. The following values are pushed onto the stack to setup the
171-
* MTRRs:
172-
* +0: Number of MTRRs
173-
* +4: MTRR base 0 31:0
174-
* +8: MTRR base 0 63:32
175-
* +12: MTRR mask 0 31:0
176-
* +16: MTRR mask 0 63:32
177-
* +20: MTRR base 1 31:0
178-
* +24: MTRR base 1 63:32
179-
* +28: MTRR mask 1 31:0
180-
* +32: MTRR mask 1 63:32
181-
* ...
182-
*/
183-
asmlinkage void *romstage_main(unsigned long bist);
184167
#endif
185168

186169
#ifdef __SMM__

src/cpu/intel/haswell/romstage.c

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
#include "southbridge/intel/lynxpoint/pch.h"
4444
#include "southbridge/intel/lynxpoint/me.h"
4545
#include <security/tpm/tspi.h>
46+
#include <cpu/intel/romstage.h>
4647

4748
static inline void reset_system(void)
4849
{
@@ -55,7 +56,7 @@ static inline void reset_system(void)
5556
/* platform_enter_postcar() determines the stack to use after
5657
* cache-as-ram is torn down as well as the MTRR settings to use,
5758
* and continues execution in postcar stage. */
58-
static void platform_enter_postcar(void)
59+
void platform_enter_postcar(void)
5960
{
6061
struct postcar_frame pcf;
6162
uintptr_t top_of_ram;
@@ -80,34 +81,6 @@ static void platform_enter_postcar(void)
8081
run_postcar_phase(&pcf);
8182
}
8283

83-
asmlinkage void *romstage_main(unsigned long bist)
84-
{
85-
int i;
86-
const int num_guards = 4;
87-
const u32 stack_guard = 0xdeadbeef;
88-
u32 *stack_base = (void *)(CONFIG_DCACHE_RAM_BASE +
89-
CONFIG_DCACHE_RAM_SIZE -
90-
CONFIG_DCACHE_RAM_ROMSTAGE_STACK_SIZE);
91-
92-
printk(BIOS_DEBUG, "Setting up stack guards.\n");
93-
for (i = 0; i < num_guards; i++)
94-
stack_base[i] = stack_guard;
95-
96-
mainboard_romstage_entry(bist);
97-
98-
/* Check the stack. */
99-
for (i = 0; i < num_guards; i++) {
100-
if (stack_base[i] == stack_guard)
101-
continue;
102-
printk(BIOS_DEBUG, "Smashed stack detected in romstage!\n");
103-
}
104-
105-
platform_enter_postcar();
106-
107-
/* We do not return here */
108-
return NULL;
109-
}
110-
11184
void romstage_common(const struct romstage_params *params)
11285
{
11386
int boot_mode;

src/mainboard/google/beltino/romstage.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <stdlib.h>
2020
#include <string.h>
2121
#include <console/console.h>
22+
#include <cpu/intel/romstage.h>
2223
#include <cpu/intel/haswell/haswell.h>
2324
#include <northbridge/intel/haswell/haswell.h>
2425
#include <northbridge/intel/haswell/raminit.h>

src/mainboard/google/slippy/romstage.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* GNU General Public License for more details.
1515
*/
1616

17-
#include <cpu/intel/haswell/haswell.h>
17+
#include <cpu/intel/romstage.h>
1818
#include "variant.h"
1919

2020

src/mainboard/intel/baskingridge/romstage.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <stdint.h>
1818
#include <stddef.h>
1919
#include <console/console.h>
20+
#include <cpu/intel/romstage.h>
2021
#include <cpu/intel/haswell/haswell.h>
2122
#include <northbridge/intel/haswell/haswell.h>
2223
#include <northbridge/intel/haswell/raminit.h>

src/northbridge/intel/haswell/Kconfig

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,6 @@ config DCACHE_RAM_MRC_VAR_SIZE
5858
help
5959
The amount of cache-as-ram region required by the reference code.
6060

61-
config DCACHE_RAM_ROMSTAGE_STACK_SIZE
62-
hex
63-
default 0x2000
64-
help
65-
The amount of anticipated stack usage from the data cache
66-
during pre-ram ROM stage execution.
67-
6861
config HAVE_MRC
6962
bool "Add a System Agent binary"
7063
help

0 commit comments

Comments
 (0)