[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [RFC PATCH 2/5] libxl: Load guest BIOS and ACPI table from file.
--- tools/libxl/libxl_dom.c | 80 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c index c2518a3..6c0a257 100644 --- a/tools/libxl/libxl_dom.c +++ b/tools/libxl/libxl_dom.c @@ -790,6 +790,32 @@ static int hvm_build_set_params(xc_interface *handle, uint32_t domid, return 0; } +static int hvm_build_set_xs_values_single_module(libxl__gc *gc, + uint32_t domid, + struct xc_hvm_firmware_module *module, + const char *module_name) +{ + char *path = NULL; + int ret; + if (module->guest_addr_out) { + path = GCSPRINTF("/local/domain/%d/hvmloader/%s/address", + domid, module_name); + + ret = libxl__xs_write(gc, XBT_NULL, path, "0x%"PRIx64, + module->guest_addr_out); + if (ret) + return ret; + + path = GCSPRINTF("/local/domain/%d/hvmloader/%s/length", + domid, module_name); + + ret = libxl__xs_write(gc, XBT_NULL, path, "0x%x", module->length); + if (ret) + return ret; + } + return 0; +} + static int hvm_build_set_xs_values(libxl__gc *gc, uint32_t domid, struct xc_hvm_build_args *args) @@ -797,6 +823,16 @@ static int hvm_build_set_xs_values(libxl__gc *gc, char *path = NULL; int ret = 0; + ret = hvm_build_set_xs_values_single_module(gc, domid, + &args->bios_module, + "bios"); + if (ret) + goto err; + ret = hvm_build_set_xs_values_single_module(gc, domid, + &args->acpi_table_module, + "acpi_table"); + if (ret) + goto err; if (args->smbios_module.guest_addr_out) { path = GCSPRINTF("/local/domain/%d/"HVM_XS_SMBIOS_PT_ADDRESS, domid); @@ -867,6 +903,50 @@ static int libxl__domain_firmware(libxl__gc *gc, args->image_file_name = libxl__abs_path(gc, firmware, libxl__xenfirmwaredir_path()); + // load bios + { + // XXX select proper bios. + const char *bios_bin_filename = libxl__abs_path(gc, "seabios.bin", + libxl__xenfirmwaredir_path()); + LOG(DEBUG, "Loading BIOS: %s", bios_bin_filename); + data = NULL; + e = libxl_read_file_contents(ctx, bios_bin_filename, + &data, &datalen); + if (e) { + LOGEV(ERROR, e, "failed to read BIOS firmware file %s", + bios_bin_filename); + goto out; + } + libxl__ptr_add(gc, data); + if (datalen) { + /* Only accept non-empty files */ + args->bios_module.data = data; + args->bios_module.length = (uint32_t)datalen; + } + } + // load acpi table + { + // XXX select proper acpi table. + const char *acpi_table_filename = libxl__abs_path(gc, + "dsdt_anycpu_qemu_xen.aml", + libxl__xenfirmwaredir_path()); + LOG(DEBUG, "Loading ACPI Table: %s", bios_bin_filename); + data = NULL; + e = libxl_read_file_contents(ctx, acpi_table_filename, + &data, &datalen); + if (e) { + LOGEV(ERROR, e, "failed to read ACPI tables file %s", + acpi_table_filename); + goto out; + } + libxl__ptr_add(gc, data); + if (datalen) { + /* Only accept non-empty files */ + args->acpi_table_module.data = data; + args->acpi_table_module.length = (uint32_t)datalen; + } + } + if (info->u.hvm.smbios_firmware) { data = NULL; e = libxl_read_file_contents(ctx, info->u.hvm.smbios_firmware, -- Anthony PERARD _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |