On Mon, 2015-10-26 at 16:03 +0000, Anthony PERARD wrote:
> ... and do not include the SeaBIOS ROM into hvmloader anymore.

... but don't yet stop including it in rom.inc (I suppose that comes later)

Can we add a new hook to chose an address for the bios which the common
code which handles the no-bios_load-hook case could use and which could be
propagated to setup_e280 instead of using a global?

seabios_config isn't a const, so you could even just set .bios_address
dynamically?

> 
> Signed-off-by: Anthony PERARD <anthony.per...@citrix.com>
> ---
>  tools/firmware/hvmloader/seabios.c | 24 ++++++++++++++----------
>  1 file changed, 14 insertions(+), 10 deletions(-)
> 
> diff --git a/tools/firmware/hvmloader/seabios.c
> b/tools/firmware/hvmloader/seabios.c
> index c6b3d9f..766bd6b 100644
> --- a/tools/firmware/hvmloader/seabios.c
> +++ b/tools/firmware/hvmloader/seabios.c
> @@ -27,9 +27,6 @@
>  #include "smbios_types.h"
>  #include "acpi/acpi2_0.h"
>  
> -#define ROM_INCLUDE_SEABIOS
> -#include "roms.inc"
> -
>  extern unsigned char dsdt_anycpu_qemu_xen[];
>  extern int dsdt_anycpu_qemu_xen_len;
>  
> @@ -121,6 +118,7 @@ static void seabios_create_pir_tables(void)
>      add_table(create_pir_tables());
>  }
>  
> +unsigned int seabios_bios_address = 0;

If it really has to remain should at least be static.

>  static void seabios_setup_e820(void)
>  {
>      struct seabios_info *info = (void *)BIOS_INFO_PHYSICAL_ADDRESS;
> @@ -128,21 +126,27 @@ static void seabios_setup_e820(void)
>      info->e820 = (uint32_t)e820;
>  
>      /* SeaBIOS reserves memory in e820 as necessary so no low
> reservation. */
> -    info->e820_nr = build_e820_table(e820, 0, 0x100000-sizeof(seabios));
> +    BUG_ON(seabios_bios_address == 0);
> +    info->e820_nr = build_e820_table(e820, 0, seabios_bios_address);
>      dump_e820_table(e820, info->e820_nr);
>  }
>  
> -struct bios_config seabios_config = {
> -    .name = "SeaBIOS",
> +static void seabios_load(const struct bios_config *bios,
> +                         void *bios_addr, uint32_t bios_length)
> +{
> +    unsigned int bios_dest = 0x100000 - bios_length;
> +    seabios_bios_address = 0x100000 - bios_length;
>  
> -    .image = seabios,
> -    .image_size = sizeof(seabios),
> +    BUG_ON(bios_dest + bios_length > HVMLOADER_PHYSICAL_ADDRESS);
> +    memcpy((void *)bios_dest, bios_addr, bios_length);
> +}
>  
> -    .bios_address = 0x100000 - sizeof(seabios),
> +struct bios_config seabios_config = {
> +    .name = "SeaBIOS",
>  
>      .load_roms = NULL,
>  
> -    .bios_load = NULL,
> +    .bios_load = seabios_load,
>  
>      .bios_info_setup = seabios_setup_bios_info,
>      .bios_info_finish = seabios_finish_bios_info,

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

Reply via email to