Merge 4.16
Change-Id: I11db70a8e25a6656c5ec640a703e7b06d5a3672e
This commit is contained in:
@@ -42,6 +42,7 @@ libc-$(CONFIG_LP_GPL) += string.c
|
||||
libgdb-y += gdb.c
|
||||
|
||||
libcbfs-$(CONFIG_LP_CBFS) += rom_media.c
|
||||
libcbfs-$(CONFIG_LP_CBFS) += boot_media.c
|
||||
|
||||
# Multiboot support is configurable
|
||||
libc-$(CONFIG_LP_MULTIBOOT) += multiboot.c
|
||||
|
18
payloads/libpayload/arch/x86/boot_media.c
Normal file
18
payloads/libpayload/arch/x86/boot_media.c
Normal file
@@ -0,0 +1,18 @@
|
||||
/* SPDX-License-Identifier: BSD-3-Clause */
|
||||
|
||||
#include <arch/virtual.h>
|
||||
#include <boot_device.h>
|
||||
#include <commonlib/bsd/cb_err.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#include <sysinfo.h>
|
||||
|
||||
__attribute__((weak)) ssize_t boot_device_read(void *buf, size_t offset, size_t size)
|
||||
{
|
||||
/* Memory-mapping usually only works for the top 16MB. */
|
||||
if (!lib_sysinfo.boot_media_size || lib_sysinfo.boot_media_size - offset > 16 * MiB)
|
||||
return CB_ERR_ARG;
|
||||
const void *const ptr = phys_to_virt(0 - lib_sysinfo.boot_media_size + offset);
|
||||
memcpy(buf, ptr, size);
|
||||
return size;
|
||||
}
|
@@ -47,20 +47,12 @@ static void cb_parse_x86_rom_var_mtrr(void *ptr, struct sysinfo_t *info)
|
||||
info->x86_rom_var_mtrr_index = rom_mtrr->index;
|
||||
}
|
||||
|
||||
static void cb_parse_mrc_cache(void *ptr, struct sysinfo_t *info)
|
||||
{
|
||||
info->mrc_cache = get_cbmem_addr(ptr);
|
||||
}
|
||||
|
||||
int cb_parse_arch_specific(struct cb_record *rec, struct sysinfo_t *info)
|
||||
{
|
||||
switch(rec->tag) {
|
||||
case CB_TAG_X86_ROM_MTRR:
|
||||
cb_parse_x86_rom_var_mtrr(rec, info);
|
||||
break;
|
||||
case CB_TAG_MRC_CACHE:
|
||||
cb_parse_mrc_cache(rec, info);
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user