diff --git a/hw/pass-through.c b/hw/pass-through.c index 4a86309..7a6e8a8 100644 --- a/hw/pass-through.c +++ b/hw/pass-through.c @@ -3565,6 +3565,7 @@ struct pt_dev * register_real_device(PCIBus *e_bus, int free_pci_slot = -1; char *key, *val; int msi_translate; + int pci_boot; PT_LOG("Assigning real physical device %02x:%02x.%x ...\n", r_bus, r_dev, r_func); @@ -3597,6 +3598,7 @@ struct pt_dev * register_real_device(PCIBus *e_bus, } msi_translate = direct_pci_msitranslate; + pci_boot = 0; while (opt) { if (get_next_keyval(&opt, &key, &val)) { PT_LOG("Error: unrecognized PCI assignment option \"%s\"\n", opt); @@ -3618,6 +3620,19 @@ struct pt_dev * register_real_device(PCIBus *e_bus, else PT_LOG("Error: unrecognized value for msitranslate=\n"); } + else if (strcmp(key, "boot") == 0) + if (strcmp(val, "0") == 0 || strcmp(val, "no") == 0) + { + PT_LOG("Disable boot option\n"); + pci_boot = 0; + } + else if (strcmp(val, "1") == 0 || strcmp(val, "yes") == 0) + { + PT_LOG("Enable boot option\n"); + pci_boot = 1; + } + else + PT_LOG("Error: unrecognized value for boot=\n"); else PT_LOG("Error: unrecognized PCI assignment option \"%s=%s\"\n", key, val); @@ -3710,6 +3725,9 @@ struct pt_dev * register_real_device(PCIBus *e_bus, *(uint16_t *)(&assigned_device->dev.config[0x04])); } + if (pci_boot) + pt_register_bootable_device(e_devfn); + out: PT_LOG("Real physical device %02x:%02x.%x registered successfuly!\n" "IRQ type = %s\n", r_bus, r_dev, r_func, diff --git a/hw/pass-through.h b/hw/pass-through.h index e86d311..cb5d3f4 100644 --- a/hw/pass-through.h +++ b/hw/pass-through.h @@ -384,5 +384,7 @@ static inline pciaddr_t pt_pci_base_addr(pciaddr_t base) return base & PCI_ADDR_MEM_MASK; } +void pt_register_bootable_device(int e_devfn); + #endif /* __PASSTHROUGH_H__ */ diff --git a/hw/pc.c b/hw/pc.c index f0492c8..ca4995a 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -237,6 +237,14 @@ static int pc_boot_set(void *opaque, const char *boot_device) return(0); } +#ifdef CONFIG_PASSTHROUGH +void pt_register_bootable_device(int e_devfn) +{ + RTCState *s = rtc_state; + rtc_set_memory(s, 0x60, e_devfn); +} +#endif + /* hd_table must contain 4 block drivers */ static void cmos_init(ram_addr_t ram_size, ram_addr_t above_4g_mem_size, const char *boot_device, BlockDriverState **hd_table) @@ -981,6 +989,8 @@ static void pc_init1(ram_addr_t ram_size, int vga_ram_size, } } + rtc_state = rtc_init(0x70, i8259[8]); + #ifdef CONFIG_PASSTHROUGH /* Pass-through Initialization * init libpci even direct_pci is null, as can hotplug a dev runtime @@ -996,8 +1006,6 @@ static void pc_init1(ram_addr_t ram_size, int vga_ram_size, } #endif - rtc_state = rtc_init(0x70, i8259[8]); - qemu_register_boot_set(pc_boot_set, rtc_state); register_ioport_read(0x92, 1, 1, ioport92_read, NULL);