Revision 6141dbfe hw/acpi_piix4.c

b/hw/acpi_piix4.c
23 23
#include "acpi.h"
24 24
#include "sysemu.h"
25 25
#include "range.h"
26
#include "ioport.h"
26 27

  
27 28
//#define DEBUG
28 29

  
......
63 64
    qemu_irq irq;
64 65
    qemu_irq smi_irq;
65 66
    int kvm_enabled;
67
    Notifier machine_ready;
66 68

  
67 69
    /* for pci hotplug */
68 70
    ACPIGPE gpe;
......
311 313
    acpi_pm1_evt_power_down(pm1a, tmr);
312 314
}
313 315

  
316
static void piix4_pm_machine_ready(struct Notifier* n)
317
{
318
    PIIX4PMState *s = container_of(n, PIIX4PMState, machine_ready);
319
    uint8_t *pci_conf;
320

  
321
    pci_conf = s->dev.config;
322
    pci_conf[0x5f] = (isa_is_ioport_assigned(0x378) ? 0x80 : 0) | 0x10;
323
    pci_conf[0x63] = 0x60;
324
    pci_conf[0x67] = (isa_is_ioport_assigned(0x3f8) ? 0x08 : 0) |
325
	(isa_is_ioport_assigned(0x2f8) ? 0x90 : 0);
326

  
327
}
328

  
314 329
static int piix4_pm_initfn(PCIDevice *dev)
315 330
{
316 331
    PIIX4PMState *s = DO_UPCAST(PIIX4PMState, dev, dev);
......
337 352

  
338 353
    /* XXX: which specification is used ? The i82731AB has different
339 354
       mappings */
340
    pci_conf[0x5f] = (parallel_hds[0] != NULL ? 0x80 : 0) | 0x10;
341
    pci_conf[0x63] = 0x60;
342
    pci_conf[0x67] = (serial_hds[0] != NULL ? 0x08 : 0) |
343
	(serial_hds[1] != NULL ? 0x90 : 0);
344

  
345 355
    pci_conf[0x90] = s->smb_io_base | 1;
346 356
    pci_conf[0x91] = s->smb_io_base >> 8;
347 357
    pci_conf[0xd2] = 0x09;
......
354 364
    qemu_system_powerdown = *qemu_allocate_irqs(piix4_powerdown, s, 1);
355 365

  
356 366
    pm_smbus_init(&s->dev.qdev, &s->smb);
367
    s->machine_ready.notify = piix4_pm_machine_ready;
368
    qemu_add_machine_init_done_notifier(&s->machine_ready);
357 369
    qemu_register_reset(piix4_reset, s);
358 370
    piix4_acpi_system_hot_add_init(dev->bus, s);
359 371

  

Also available in: Unified diff