mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-10 23:24:38 +00:00
x86: fsp: Allow skipping init code when chain loading
It is useful to be able to boot the same x86 image on a device with or without a first-stage bootloader. For example, with chromebook_coral, it is helpful for testing to be able to boot the same U-Boot (complete with FSP) on bare metal and from coreboot. It allows checking of things like CPU speed, comparing registers, ACPI tables and the like. When U-Boot is not the first-stage bootloader much of this code is not needed and can break booting. Add checks for this to the FSP code. Rather than checking for the amount of available SDRAM, just use 1GB in this situation, which should be safe. Using 2GB may run into a memory hole on some SoCs. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
This commit is contained in:
parent
0b885bcfd9
commit
c793dbdb90
4 changed files with 22 additions and 1 deletions
|
@ -44,6 +44,14 @@ int dram_init_banksize(void)
|
||||||
phys_addr_t low_end;
|
phys_addr_t low_end;
|
||||||
uint bank;
|
uint bank;
|
||||||
|
|
||||||
|
if (!ll_boot_init()) {
|
||||||
|
gd->bd->bi_dram[0].start = 0;
|
||||||
|
gd->bd->bi_dram[0].size = gd->ram_size;
|
||||||
|
|
||||||
|
mtrr_add_request(MTRR_TYPE_WRBACK, 0, gd->ram_size);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
low_end = 0;
|
low_end = 0;
|
||||||
for (bank = 1, hdr = gd->arch.hob_list;
|
for (bank = 1, hdr = gd->arch.hob_list;
|
||||||
bank < CONFIG_NR_DRAM_BANKS && !end_of_hob(hdr);
|
bank < CONFIG_NR_DRAM_BANKS && !end_of_hob(hdr);
|
||||||
|
|
|
@ -78,6 +78,9 @@ static int fsp_video_probe(struct udevice *dev)
|
||||||
struct vesa_mode_info *vesa = &mode_info.vesa;
|
struct vesa_mode_info *vesa = &mode_info.vesa;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
if (!ll_boot_init())
|
||||||
|
return 0;
|
||||||
|
|
||||||
printf("Video: ");
|
printf("Video: ");
|
||||||
|
|
||||||
/* Initialize vesa_mode_info structure */
|
/* Initialize vesa_mode_info structure */
|
||||||
|
|
|
@ -12,11 +12,18 @@
|
||||||
#include <asm/fsp/fsp_support.h>
|
#include <asm/fsp/fsp_support.h>
|
||||||
#include <asm/fsp2/fsp_api.h>
|
#include <asm/fsp2/fsp_api.h>
|
||||||
#include <asm/fsp2/fsp_internal.h>
|
#include <asm/fsp2/fsp_internal.h>
|
||||||
|
#include <linux/sizes.h>
|
||||||
|
|
||||||
int dram_init(void)
|
int dram_init(void)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
if (!ll_boot_init()) {
|
||||||
|
/* Use a small and safe amount of 1GB */
|
||||||
|
gd->ram_size = SZ_1G;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
if (spl_phase() == PHASE_SPL) {
|
if (spl_phase() == PHASE_SPL) {
|
||||||
#ifdef CONFIG_HAVE_ACPI_RESUME
|
#ifdef CONFIG_HAVE_ACPI_RESUME
|
||||||
bool s3wake = gd->arch.prev_sleep_state == ACPI_S3;
|
bool s3wake = gd->arch.prev_sleep_state == ACPI_S3;
|
||||||
|
@ -68,6 +75,9 @@ int dram_init(void)
|
||||||
|
|
||||||
ulong board_get_usable_ram_top(ulong total_size)
|
ulong board_get_usable_ram_top(ulong total_size)
|
||||||
{
|
{
|
||||||
|
if (!ll_boot_init())
|
||||||
|
return gd->ram_size;
|
||||||
|
|
||||||
#if CONFIG_IS_ENABLED(HANDOFF)
|
#if CONFIG_IS_ENABLED(HANDOFF)
|
||||||
struct spl_handoff *ho = gd->spl_handoff;
|
struct spl_handoff *ho = gd->spl_handoff;
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ int arch_cpu_init_dm(void)
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* Make sure pads are set up early in U-Boot */
|
/* Make sure pads are set up early in U-Boot */
|
||||||
if (spl_phase() != PHASE_BOARD_F)
|
if (!ll_boot_init() || spl_phase() != PHASE_BOARD_F)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* Probe all pinctrl devices to set up the pads */
|
/* Probe all pinctrl devices to set up the pads */
|
||||||
|
|
Loading…
Reference in a new issue