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

@@ -22,6 +22,7 @@
#include <soc/iomap.h>
#include <soc/cpu.h>
#include <soc/gpio.h>
#include <soc/mmap_boot.h>
#include <soc/northbridge.h>
#include <soc/pci_devs.h>
#include <soc/uart.h>
@@ -87,7 +88,8 @@ void asmlinkage bootblock_c_entry(uint64_t base_timestamp)
static void cache_bios_region(void)
{
int mtrr;
uint32_t rom_size, alignment;
size_t rom_size;
uint32_t alignment;
mtrr = get_free_var_mtrr();
@@ -95,7 +97,8 @@ static void cache_bios_region(void)
return;
/* Only the IFD BIOS region is memory mapped (at top of 4G) */
rom_size = CONFIG_IFD_BIOS_END - CONFIG_IFD_BIOS_START;
rom_size = get_bios_size();
/* Round to power of two */
alignment = 1 << (log2_ceil(rom_size));
rom_size = ALIGN_UP(rom_size, alignment);