[coreboot-gerrit] New patch to review for coreboot: 0c295ff libpayload: Add comments on virtual pointers in lib_sysinfo
Nico Huber (nico.huber@secunet.com)
gerrit at coreboot.org
Fri Mar 22 09:43:28 CET 2013
Nico Huber (nico.huber at secunet.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/2878
-gerrit
commit 0c295ff543873da0857dedf409b9d1a938a35795
Author: Nico Huber <nico.huber at secunet.com>
Date: Fri Feb 8 12:39:28 2013 +0100
libpayload: Add comments on virtual pointers in lib_sysinfo
After another incident related to virtual pointers in lib_sysinfo (and
resulting confusion), I decided to put some comments on the matter into
the code.
Remember, we decided to always use virtual pointers in lib_sysinfo, but
it's not always obvious from the code, that they are.
See also:
425973c libpayload: Always use virtual pointers in struct sysinfo_t
593f577 libpayload: Fix use of virtual pointers in sysinfo
Change-Id: I886c3b1d182cba07f1aab1667e702e2868ad4b68
Signed-off-by: Nico Huber <nico.huber at secunet.com>
---
payloads/libpayload/arch/armv7/coreboot.c | 2 ++
payloads/libpayload/arch/x86/coreboot.c | 2 ++
payloads/libpayload/include/sysinfo.h | 6 ++++++
3 files changed, 10 insertions(+)
diff --git a/payloads/libpayload/arch/armv7/coreboot.c b/payloads/libpayload/arch/armv7/coreboot.c
index 0003c29..9545f29 100644
--- a/payloads/libpayload/arch/armv7/coreboot.c
+++ b/payloads/libpayload/arch/armv7/coreboot.c
@@ -129,6 +129,7 @@ static void cb_parse_mrc_cache(unsigned char *ptr, struct sysinfo_t *info)
#ifdef CONFIG_NVRAM
static void cb_parse_optiontable(void *ptr, struct sysinfo_t *info)
{
+ /* ptr points to a coreboot table entry and is already virtual */
info->option_table = ptr;
}
@@ -144,6 +145,7 @@ static void cb_parse_checksum(void *ptr, struct sysinfo_t *info)
#ifdef CONFIG_COREBOOT_VIDEO_CONSOLE
static void cb_parse_framebuffer(void *ptr, struct sysinfo_t *info)
{
+ /* ptr points to a coreboot table entry and is already virtual */
info->framebuffer = ptr;
}
#endif
diff --git a/payloads/libpayload/arch/x86/coreboot.c b/payloads/libpayload/arch/x86/coreboot.c
index e8bc380..f4f9b86 100644
--- a/payloads/libpayload/arch/x86/coreboot.c
+++ b/payloads/libpayload/arch/x86/coreboot.c
@@ -137,6 +137,7 @@ static void cb_parse_mrc_cache(unsigned char *ptr, struct sysinfo_t *info)
#ifdef CONFIG_NVRAM
static void cb_parse_optiontable(void *ptr, struct sysinfo_t *info)
{
+ /* ptr points to a coreboot table entry and is already virtual */
info->option_table = ptr;
}
@@ -152,6 +153,7 @@ static void cb_parse_checksum(void *ptr, struct sysinfo_t *info)
#ifdef CONFIG_COREBOOT_VIDEO_CONSOLE
static void cb_parse_framebuffer(void *ptr, struct sysinfo_t *info)
{
+ /* ptr points to a coreboot table entry and is already virtual */
info->framebuffer = ptr;
}
#endif
diff --git a/payloads/libpayload/include/sysinfo.h b/payloads/libpayload/include/sysinfo.h
index 4c7ce45..e05ef9f 100644
--- a/payloads/libpayload/include/sysinfo.h
+++ b/payloads/libpayload/include/sysinfo.h
@@ -39,6 +39,12 @@
struct cb_serial;
+/*
+ * All pointers in here shall be virtual.
+ *
+ * If a relocation happens after the last call to lib_get_sysinfo(),
+ * it is up to the user to call lib_get_sysinfo() again.
+ */
struct sysinfo_t {
unsigned int cpu_khz;
struct cb_serial *serial;
More information about the coreboot-gerrit
mailing list