libpayload: Cache physical CMOS option table location
In the presence of self-relocating payloads, it's safer to keep physical addresses in `libsysinfo`. Change-Id: I64a37bef263022edb504086c02a3fd22ce068ba4 Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/c/coreboot/+/43576 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Julius Werner <jwerner@chromium.org>
This commit is contained in:
		
				
					committed by
					
						
						Patrick Georgi
					
				
			
			
				
	
			
			
			
						parent
						
							14adb7eaa9
						
					
				
				
					commit
					b2eafa666c
				
			@@ -53,7 +53,7 @@ struct nvram_accessor *use_mem = &(struct nvram_accessor) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
struct cb_cmos_option_table *get_system_option_table(void)
 | 
					struct cb_cmos_option_table *get_system_option_table(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	return lib_sysinfo.option_table;
 | 
						return phys_to_virt(lib_sysinfo.cmos_option_table);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int options_checksum_valid(const struct nvram_accessor *nvram)
 | 
					int options_checksum_valid(const struct nvram_accessor *nvram)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -63,7 +63,7 @@ struct sysinfo_t {
 | 
				
			|||||||
		unsigned int type;
 | 
							unsigned int type;
 | 
				
			||||||
	} memrange[SYSINFO_MAX_MEM_RANGES];
 | 
						} memrange[SYSINFO_MAX_MEM_RANGES];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct cb_cmos_option_table *option_table;
 | 
						uintptr_t cmos_option_table;
 | 
				
			||||||
	u32 cmos_range_start;
 | 
						u32 cmos_range_start;
 | 
				
			||||||
	u32 cmos_range_end;
 | 
						u32 cmos_range_end;
 | 
				
			||||||
	u32 cmos_checksum_location;
 | 
						u32 cmos_checksum_location;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -170,8 +170,8 @@ static void cb_parse_sku_id(unsigned char *ptr, struct sysinfo_t *info)
 | 
				
			|||||||
#if CONFIG(LP_NVRAM)
 | 
					#if CONFIG(LP_NVRAM)
 | 
				
			||||||
static void cb_parse_optiontable(void *ptr, struct sysinfo_t *info)
 | 
					static void cb_parse_optiontable(void *ptr, struct sysinfo_t *info)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	/* ptr points to a coreboot table entry and is already virtual */
 | 
						/* ptr is already virtual, but we want to keep physical addresses */
 | 
				
			||||||
	info->option_table = ptr;
 | 
						info->cmos_option_table = virt_to_phys(ptr);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void cb_parse_checksum(void *ptr, struct sysinfo_t *info)
 | 
					static void cb_parse_checksum(void *ptr, struct sysinfo_t *info)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user