intel/apollolake: Add API for get_bios_size and use it

get_bios_size returns the value of bios_size. Use this function to
calculate bios_size for caching in bootblock.

BUG=chrome-os-partner:54563

Change-Id: I2e592b1c52138bd4623ad2acd05c744224a8e50b
Signed-off-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: https://review.coreboot.org/15292
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Tested-by: build bot (Jenkins)
This commit is contained in:
Furquan Shaikh
2016-06-21 12:50:13 -07:00
parent 14b2a4d574
commit 8065bd4ce1
3 changed files with 34 additions and 7 deletions

View File

@@ -23,6 +23,7 @@
#include <console/console.h>
#include <fmap.h>
#include <soc/intel/common/nvm.h>
#include <soc/mmap_boot.h>
#include <soc/spi.h>
/*
@@ -87,11 +88,6 @@ static void bios_mmap_init(void)
SPIBAR_BFPREG_PRL_SHIFT) + 1) * 4 * KiB;
size = bios_end - start;
printk(BIOS_INFO, "IFD BIOS region info loaded from FLREG%d\n",
(val & SPIBAR_BFPREG_SBRS) ? 6 : 1);
printk(BIOS_INFO, "IFD BIOS Start: 0x%zx\n", start);
printk(BIOS_INFO, "IFD BIOS End : 0x%zx\n", bios_end);
/* BIOS region is mapped right below 4G. */
base = 4ULL * GiB - size;
@@ -167,3 +163,9 @@ uint32_t nvm_mmio_to_flash_offset(void *p)
*/
return (uintptr_t)p - (4ULL * GiB - size) + start;
}
size_t get_bios_size(void)
{
bios_mmap_init();
return car_get_var(bios_size);
}