Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP2:Update
xen.6114
0008-hvmloader-Locate-the-BIOS-blob.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0008-hvmloader-Locate-the-BIOS-blob.patch of Package xen.6114
From 463aedc4fd6e09518b4711e931048bf932b6ee39 Mon Sep 17 00:00:00 2001 From: Anthony PERARD <anthony.perard@citrix.com> Date: Mon, 14 Mar 2016 17:55:43 +0000 Subject: [PATCH 08/15] hvmloader: Locate the BIOS blob The BIOS can be found an entry called "bios" of the modlist of the hvm_start_info struct. The found BIOS blob is not loaded by this patch, but only passed as argument to bios_load() function. It is going to be used by the next few patches. Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> --- tools/firmware/hvmloader/config.h | 2 +- tools/firmware/hvmloader/hvmloader.c | 42 ++++++++++++++++++++++++++++++++++-- tools/firmware/hvmloader/ovmf.c | 3 ++- tools/firmware/hvmloader/rombios.c | 3 ++- tools/firmware/hvmloader/util.h | 2 ++ 5 files changed, 47 insertions(+), 5 deletions(-) Index: xen-4.7.0-testing/tools/firmware/hvmloader/config.h =================================================================== --- xen-4.7.0-testing.orig/tools/firmware/hvmloader/config.h +++ xen-4.7.0-testing/tools/firmware/hvmloader/config.h @@ -22,7 +22,7 @@ struct bios_config { /* ROMS */ void (*load_roms)(void); - void (*bios_load)(const struct bios_config *config); + void (*bios_load)(const struct bios_config *config, void *addr, uint32_t size); void (*bios_info_setup)(void); void (*bios_info_finish)(void); Index: xen-4.7.0-testing/tools/firmware/hvmloader/hvmloader.c =================================================================== --- xen-4.7.0-testing.orig/tools/firmware/hvmloader/hvmloader.c +++ xen-4.7.0-testing/tools/firmware/hvmloader/hvmloader.c @@ -253,10 +253,40 @@ static void acpi_enable_sci(void) BUG_ON(!(pm1a_cnt_val & ACPI_PM1C_SCI_EN)); } +const struct hvm_modlist_entry *get_module_entry( + const struct hvm_start_info *info, + const char *name) +{ + const struct hvm_modlist_entry *modlist = + (struct hvm_modlist_entry *)((uintptr_t)info->modlist_paddr); + unsigned int i; + + if ( !modlist ) + return NULL; + + for ( i = 0; i < info->nr_modules; i++ ) + { + uint32_t module_name = modlist[i].cmdline_paddr; + + BUG_ON(!modlist[i].cmdline_paddr || + modlist[i].cmdline_paddr > UINT_MAX); + + if ( !strcmp(name, (char*)module_name) ) + { + BUG_ON(!modlist[i].paddr || modlist[i].paddr > UINT_MAX || + modlist[i].size > UINT_MAX); + return &modlist[i]; + } + } + + return NULL; +} + int main(void) { const struct bios_config *bios; int acpi_enabled; + const struct hvm_modlist_entry *bios_module; /* Initialise hypercall stubs with RET, rendering them no-ops. */ memset((void *)HYPERCALL_PHYSICAL_ADDRESS, 0xc3 /* RET */, PAGE_SIZE); @@ -292,8 +322,16 @@ int main(void) } printf("Loading %s ...\n", bios->name); - if ( bios->bios_load ) - bios->bios_load(bios); + bios_module = get_module_entry(hvm_start_info, "bios"); + if ( bios_module && bios->bios_load ) + { + uint32_t paddr = bios_module->paddr; + bios->bios_load(bios, (void*)paddr, bios_module->size); + } + else if ( bios->bios_load ) + { + bios->bios_load(bios, 0, 0); + } else { BUG_ON(bios->bios_address + bios->image_size > Index: xen-4.7.0-testing/tools/firmware/hvmloader/ovmf.c =================================================================== --- xen-4.7.0-testing.orig/tools/firmware/hvmloader/ovmf.c +++ xen-4.7.0-testing/tools/firmware/hvmloader/ovmf.c @@ -93,7 +93,8 @@ static void ovmf_finish_bios_info(void) info->checksum = -checksum; } -static void ovmf_load(const struct bios_config *config) +static void ovmf_load(const struct bios_config *config, + void *bios_addr, uint32_t bios_length) { xen_pfn_t mfn; uint64_t addr = OVMF_BEGIN; Index: xen-4.7.0-testing/tools/firmware/hvmloader/rombios.c =================================================================== --- xen-4.7.0-testing.orig/tools/firmware/hvmloader/rombios.c +++ xen-4.7.0-testing/tools/firmware/hvmloader/rombios.c @@ -121,7 +121,8 @@ static void rombios_load_roms(void) option_rom_phys_addr + option_rom_sz - 1); } -static void rombios_load(const struct bios_config *config) +static void rombios_load(const struct bios_config *config, + void *unused_addr, uint32_t unused_size) { uint32_t bioshigh; struct rombios_info *info; Index: xen-4.7.0-testing/tools/firmware/hvmloader/util.h =================================================================== --- xen-4.7.0-testing.orig/tools/firmware/hvmloader/util.h +++ xen-4.7.0-testing/tools/firmware/hvmloader/util.h @@ -34,6 +34,8 @@ enum { #undef NULL #define NULL ((void*)0) +#define UINT_MAX (~0U) + void __assert_failed(char *assertion, char *file, int line) __attribute__((noreturn)); #define ASSERT(p) \
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor