soc/amd/stoneyridge: remove LIDS field from global NVS
[coreboot.git] / payloads / libpayload / arch / x86 / boot_media.c
blob99fb4e3c2a943f0b67d40ec4e50c70068777bc59
1 /* SPDX-License-Identifier: BSD-3-Clause */
3 #include <arch/virtual.h>
4 #include <boot_device.h>
5 #include <commonlib/bsd/cb_err.h>
6 #include <stddef.h>
7 #include <string.h>
8 #include <sysinfo.h>
10 __attribute__((weak)) ssize_t boot_device_read(void *buf, size_t offset, size_t size)
12 /* Memory-mapping usually only works for the top 16MB. */
13 if (!lib_sysinfo.boot_media_size || lib_sysinfo.boot_media_size - offset > 16 * MiB)
14 return CB_ERR_ARG;
15 const void *const ptr = phys_to_virt(0 - lib_sysinfo.boot_media_size + offset);
16 memcpy(buf, ptr, size);
17 return size;