From 425973cf42ad5c298dd2f501d8b9437c60ae9b6f Mon Sep 17 00:00:00 2001 From: Nico Huber Date: Tue, 13 Nov 2012 17:11:01 +0100 Subject: libpayload: Always use virtual pointers in struct sysinfo_t We had mixed virtual and physical pointers in struct sysinfo_t. Some being virtual by accident which led to problems when we tried to reinitialize lib_sysinfo after relocating FILO (to get intentionally virtual pointers valid again). I guess this didn't cause much trouble before, as lib_get_sysinfo() was always called with physical addresses being equal to their virtual counterparts. For FILO, two possibilities seem practical: Either, have all pointers in struct sysinfo_t physical, so relocation doesn't hurt. Or, have all pointers virtual and call lib_get_sysinfo() again after relocation. This patch goes the latter way, changing the following pointers for situations where virtual pointers differ from physical: .extra_version .build .compile_time .compile_by .compile_host .compile_domain .compiler .linker .assembler .cb_version .vdat_addr .tstamp_table .cbmem_cons .mrc_cache We could also just correct the accidentally virtual pointers. But, IMO, this would lower the risk of future confusion. Note 1: Looks like .version gets never set. Note 2: .option_table and .framebuffer were virtual pointers but treated like physical ones. Even in FILO, this led to no problems as they were set before relocation. Change-Id: I4c456f56f049d9f8fc40e62520b1d8ec3dad48f8 Signed-off-by: Nico Huber Reviewed-on: http://review.coreboot.org/1855 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer --- payloads/libpayload/drivers/video/corebootfb.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'payloads/libpayload/drivers/video') diff --git a/payloads/libpayload/drivers/video/corebootfb.c b/payloads/libpayload/drivers/video/corebootfb.c index 0fb1740785..5672d1f375 100644 --- a/payloads/libpayload/drivers/video/corebootfb.c +++ b/payloads/libpayload/drivers/video/corebootfb.c @@ -63,11 +63,11 @@ static const u32 vga_colors[] = { }; /* Addresses for the various components */ -static unsigned long fbinfo; +static struct cb_framebuffer *fbinfo; static unsigned long fbaddr; static unsigned long chars; -#define FI ((struct cb_framebuffer *) phys_to_virt(fbinfo)) +#define FI (fbinfo) #define FB ((unsigned char *) phys_to_virt(fbaddr)) #define CHARS ((unsigned short *) phys_to_virt(chars)) @@ -233,7 +233,7 @@ static int corebootfb_init(void) if (lib_sysinfo.framebuffer == NULL) return -1; - fbinfo = (unsigned long)lib_sysinfo.framebuffer; + fbinfo = lib_sysinfo.framebuffer; fbaddr = FI->physical_address; -- cgit v1.2.3