]> git.proxmox.com Git - mirror_qemu.git/commitdiff
audio: create pcspk device early
authorGerd Hoffmann <kraxel@redhat.com>
Thu, 2 Jul 2020 13:25:21 +0000 (15:25 +0200)
committerGerd Hoffmann <kraxel@redhat.com>
Mon, 6 Jul 2020 15:01:11 +0000 (17:01 +0200)
Create the pcspk device early, so it exists at
machine type initialization time.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 20200702132525.6849-17-kraxel@redhat.com

hw/i386/pc.c
include/hw/i386/pc.h

index 4fc1b7048b28744097bad13434454a5241a96fc5..88785f9dcc7012afabb20348d944093c63165c00 100644 (file)
@@ -1219,7 +1219,7 @@ void pc_basic_device_init(struct PCMachineState *pcms,
             /* connect PIT to output control line of the HPET */
             qdev_connect_gpio_out(hpet, 0, qdev_get_gpio_in(DEVICE(pit), 0));
         }
-        pcspk_init(isa_new(TYPE_PC_SPEAKER), isa_bus, pit);
+        pcspk_init(pcms->pcspk, isa_bus, pit);
     }
 
     i8257_dma_init(isa_bus, 0);
@@ -1891,6 +1891,7 @@ static void pc_machine_initfn(Object *obj)
     pcms->pit_enabled = true;
 
     pc_system_flash_create(pcms);
+    pcms->pcspk = isa_new(TYPE_PC_SPEAKER);
 }
 
 static void pc_machine_reset(MachineState *machine)
index d7690bf4290fe5e4a89f5c1f4feadac7f0bd2b3a..a802e699749a506e96148c71984dbc02b75f1e8f 100644 (file)
@@ -33,6 +33,7 @@ struct PCMachineState {
     PCIBus *bus;
     I2CBus *smbus;
     PFlashCFI01 *flash[2];
+    ISADevice *pcspk;
 
     /* Configuration options: */
     uint64_t max_ram_below_4g;