From 1e7545fd7cf40876121ab3ce185c90e555a81dc2 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Tue, 12 Apr 2011 14:00:49 +0100 Subject: [PATCH] tools: hvmloader: select BIOS through xenstore. Allow the toolstack to select the BIOS to use via a xenstore key. Defaults to "rombios" for compatibility with toolstacks which do not write the key (e.g. xend). Signed-off-by: Ian Campbell Signed-off-by: Keir Fraser --- tools/firmware/hvmloader/hvmloader.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/tools/firmware/hvmloader/hvmloader.c b/tools/firmware/hvmloader/hvmloader.c index 4fcbd9c499..bbbc964f9c 100644 --- a/tools/firmware/hvmloader/hvmloader.c +++ b/tools/firmware/hvmloader/hvmloader.c @@ -337,10 +337,30 @@ static void cmos_write_memory_size(void) cmos_outb(0x35, (uint8_t)( alt_mem >> 8)); } +struct bios_info { + const char *key; + const struct bios_config *bios; +} bios_configs[] = { + { "rombios", &rombios_config, }, + { NULL, NULL } +}; static const struct bios_config *detect_bios(void) { - return &rombios_config; + const struct bios_info *b; + const char *bios; + + bios = xenstore_read("hvmloader/bios"); + if ( !bios ) + bios = "rombios"; + + for ( b = &bios_configs[0]; b->key != NULL; b++ ) + if ( !strcmp(bios, b->key) ) + return b->bios; + + printf("Unknown BIOS %s, no ROM image found\n", bios); + BUG(); + return NULL; } int main(void) -- 2.39.5