qemu/include/hw/acpi/bios-linker-loader.h
Marc-André Lureau c8389550de vmgenid: replace x-write-pointer-available hack
This compat property sole function is to prevent the device from being
instantiated. Instead of requiring an extra compat property, check if
fw_cfg has DMA enabled.

fw_cfg is a built-in device that is initialized very early by the
machine init code.  We have at least one other device that also
assumes fw_cfg_find() can be safely used on realize: pvpanic.

This has the additional benefit of handling other cases properly, like:

  $ qemu-system-x86_64 -device vmgenid -machine none
  qemu-system-x86_64: -device vmgenid: vmgenid requires DMA write support in fw_cfg, which this machine type does not provide
  $ qemu-system-x86_64 -device vmgenid -machine pc-i440fx-2.9 -global fw_cfg.dma_enabled=off
  qemu-system-x86_64: -device vmgenid: vmgenid requires DMA write support in fw_cfg, which this machine type does not provide
  $ qemu-system-x86_64 -device vmgenid -machine pc-i440fx-2.6 -global fw_cfg.dma_enabled=on
  [boots normally]

Suggested-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Ben Warren <ben@skyportsystems.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2017-09-08 16:15:17 +03:00

40 lines
1.5 KiB
C

#ifndef BIOS_LINKER_LOADER_H
#define BIOS_LINKER_LOADER_H
typedef struct BIOSLinker {
GArray *cmd_blob;
GArray *file_list;
} BIOSLinker;
bool bios_linker_loader_can_write_pointer(void);
BIOSLinker *bios_linker_loader_init(void);
void bios_linker_loader_alloc(BIOSLinker *linker,
const char *file_name,
GArray *file_blob,
uint32_t alloc_align,
bool alloc_fseg);
void bios_linker_loader_add_checksum(BIOSLinker *linker, const char *file,
unsigned start_offset, unsigned size,
unsigned checksum_offset);
void bios_linker_loader_add_pointer(BIOSLinker *linker,
const char *dest_file,
uint32_t dst_patched_offset,
uint8_t dst_patched_size,
const char *src_file,
uint32_t src_offset);
void bios_linker_loader_write_pointer(BIOSLinker *linker,
const char *dest_file,
uint32_t dst_patched_offset,
uint8_t dst_patched_size,
const char *src_file,
uint32_t src_offset);
void bios_linker_loader_cleanup(BIOSLinker *linker);
#endif