Revision 53b67b30

b/Makefile.objs
146 146
hw-obj-$(CONFIG_USB_UHCI) += usb-uhci.o
147 147
hw-obj-$(CONFIG_USB_OHCI) += usb-ohci.o
148 148
hw-obj-$(CONFIG_FDC) += fdc.o
149
hw-obj-$(CONFIG_ACPI) += acpi.o
149 150

  
150 151
# PCI watchdog devices
151 152
hw-obj-y += wdt_i6300esb.o
b/Makefile.target
184 184
obj-i386-y = pckbd.o dma.o
185 185
obj-i386-y += vga.o
186 186
obj-i386-y += mc146818rtc.o i8259.o pc.o
187
obj-i386-y += cirrus_vga.o apic.o ioapic.o acpi.o piix_pci.o
187
obj-i386-y += cirrus_vga.o apic.o ioapic.o piix_pci.o
188 188
obj-i386-y += vmmouse.o vmport.o hpet.o
189 189
obj-i386-y += device-hotplug.o pci-hotplug.o smbios.o wdt_ib700.o
190 190
obj-i386-y += debugcon.o multiboot.o
......
213 213
obj-mips-y += mips_addr.o mips_timer.o mips_int.o
214 214
obj-mips-y += dma.o vga.o i8259.o
215 215
obj-mips-y += g364fb.o jazz_led.o
216
obj-mips-y += gt64xxx.o pckbd.o mc146818rtc.o acpi.o
216
obj-mips-y += gt64xxx.o pckbd.o mc146818rtc.o
217 217
obj-mips-y += piix4.o cirrus_vga.o
218 218
obj-mips-y += pflash_cfi01.o
219 219

  
b/default-configs/i386-softmmu.mak
10 10
CONFIG_PCSPK=y
11 11
CONFIG_USB_UHCI=y
12 12
CONFIG_FDC=y
13
CONFIG_ACPI=y
13 14
CONFIG_IDE_CORE=y
14 15
CONFIG_IDE_QDEV=y
15 16
CONFIG_IDE_PCI=y
b/default-configs/mips-softmmu.mak
12 12
CONFIG_PCSPK=y
13 13
CONFIG_USB_UHCI=y
14 14
CONFIG_FDC=y
15
CONFIG_ACPI=y
15 16
CONFIG_IDE_CORE=y
16 17
CONFIG_IDE_QDEV=y
17 18
CONFIG_IDE_PCI=y
b/default-configs/mips64-softmmu.mak
12 12
CONFIG_PCSPK=y
13 13
CONFIG_USB_UHCI=y
14 14
CONFIG_FDC=y
15
CONFIG_ACPI=y
15 16
CONFIG_IDE_CORE=y
16 17
CONFIG_IDE_QDEV=y
17 18
CONFIG_IDE_PCI=y
b/default-configs/mips64el-softmmu.mak
12 12
CONFIG_PCSPK=y
13 13
CONFIG_USB_UHCI=y
14 14
CONFIG_FDC=y
15
CONFIG_ACPI=y
15 16
CONFIG_IDE_CORE=y
16 17
CONFIG_IDE_QDEV=y
17 18
CONFIG_IDE_PCI=y
b/default-configs/mipsel-softmmu.mak
12 12
CONFIG_PCSPK=y
13 13
CONFIG_USB_UHCI=y
14 14
CONFIG_FDC=y
15
CONFIG_ACPI=y
15 16
CONFIG_IDE_CORE=y
16 17
CONFIG_IDE_QDEV=y
17 18
CONFIG_IDE_PCI=y
b/default-configs/x86_64-softmmu.mak
10 10
CONFIG_PCSPK=y
11 11
CONFIG_USB_UHCI=y
12 12
CONFIG_FDC=y
13
CONFIG_ACPI=y
13 14
CONFIG_IDE_CORE=y
14 15
CONFIG_IDE_QDEV=y
15 16
CONFIG_IDE_PCI=y
b/hw/acpi.c
22 22
#include "sysemu.h"
23 23
#include "i2c.h"
24 24
#include "smbus.h"
25
#include "kvm.h"
26 25

  
27 26
//#define DEBUG
28 27

  
......
50 49
    uint8_t smb_data[32];
51 50
    uint8_t smb_index;
52 51
    qemu_irq irq;
52
    qemu_irq cmos_s3;
53
    qemu_irq smi_irq;
54
    int kvm_enabled;
53 55
} PIIX4PMState;
54 56

  
55 57
#define RSM_STS (1 << 15)
......
158 160
                       was caused by power button */
159 161
                    s->pmsts |= (RSM_STS | PWRBTN_STS);
160 162
                    qemu_system_reset_request();
161
#if defined(TARGET_I386)
162
                    cmos_set_s3_resume();
163
#endif
163
                    if (s->cmos_s3) {
164
                        qemu_irq_raise(s->cmos_s3);
165
                    }
164 166
                default:
165 167
                    break;
166 168
                }
......
248 250
        }
249 251

  
250 252
        if (s->dev.config[0x5b] & (1 << 1)) {
251
            cpu_interrupt(first_cpu, CPU_INTERRUPT_SMI);
253
            if (s->smi_irq) {
254
                qemu_irq_raise(s->smi_irq);
255
            }
252 256
        }
253 257
    } else {
254 258
        s->apms = val;
......
478 482
    pci_conf[0x5a] = 0;
479 483
    pci_conf[0x5b] = 0;
480 484

  
481
    if (kvm_enabled()) {
485
    if (s->kvm_enabled) {
482 486
        /* Mark SMM as already inited (until KVM supports SMM). */
483 487
        pci_conf[0x5B] = 0x02;
484 488
    }
......
486 490

  
487 491
static void piix4_powerdown(void *opaque, int irq, int power_failing)
488 492
{
489
#if defined(TARGET_I386)
490 493
    PIIX4PMState *s = opaque;
491 494

  
492 495
    if (!s) {
......
495 498
        s->pmsts |= PWRBTN_EN;
496 499
        pm_update_sci(s);
497 500
    }
498
#endif
499 501
}
500 502

  
501 503
i2c_bus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
502
                       qemu_irq sci_irq)
504
                       qemu_irq sci_irq, qemu_irq cmos_s3, qemu_irq smi_irq,
505
                       int kvm_enabled)
503 506
{
504 507
    PIIX4PMState *s;
505 508
    uint8_t *pci_conf;
......
526 529

  
527 530
    register_ioport_write(ACPI_DBG_IO_ADDR, 4, 4, acpi_dbg_writel, s);
528 531

  
529
    if (kvm_enabled()) {
532
    if (kvm_enabled) {
530 533
        /* Mark SMM as already inited to prevent SMM from running.  KVM does not
531 534
         * support SMM mode. */
532 535
        pci_conf[0x5B] = 0x02;
......
553 556

  
554 557
    s->smbus = i2c_init_bus(NULL, "i2c");
555 558
    s->irq = sci_irq;
559
    s->cmos_s3 = cmos_s3;
560
    s->smi_irq = smi_irq;
556 561
    qemu_register_reset(piix4_reset, s);
557 562

  
558 563
    return s->smbus;
b/hw/mips_malta.c
924 924
    isa_bus_irqs(i8259);
925 925
    pci_piix4_ide_init(pci_bus, hd, piix4_devfn + 1);
926 926
    usb_uhci_piix4_init(pci_bus, piix4_devfn + 2);
927
    smbus = piix4_pm_init(pci_bus, piix4_devfn + 3, 0x1100, isa_reserve_irq(9));
927
    smbus = piix4_pm_init(pci_bus, piix4_devfn + 3, 0x1100, isa_reserve_irq(9),
928
                          NULL, NULL, 0);
928 929
    eeprom_buf = qemu_mallocz(8 * 256); /* XXX: make this persistent */
929 930
    for (i = 0; i < 8; i++) {
930 931
        /* TODO: Populate SPD eeprom data.  */
b/hw/pc.c
46 46
#include "loader.h"
47 47
#include "elf.h"
48 48
#include "multiboot.h"
49
#include "kvm.h"
49 50

  
50 51
/* output Bochs bios info messages */
51 52
//#define DEBUG_BIOS
......
752 753
    return env->cpu_index == 0;
753 754
}
754 755

  
756
/* set CMOS shutdown status register (index 0xF) as S3_resume(0xFE)
757
   BIOS will read it and start S3 resume at POST Entry */
758
static void cmos_set_s3_resume(void *opaque, int irq, int level)
759
{
760
    RTCState *s = opaque;
761

  
762
    if (level) {
763
        rtc_set_memory(s, 0xF, 0xFE);
764
    }
765
}
766

  
767
static void acpi_smi_interrupt(void *opaque, int irq, int level)
768
{
769
    CPUState *s = opaque;
770

  
771
    if (level) {
772
        cpu_interrupt(s, CPU_INTERRUPT_SMI);
773
    }
774
}
775

  
755 776
static CPUState *pc_new_cpu(const char *cpu_model)
756 777
{
757 778
    CPUState *env;
......
792 813
    qemu_irq *cpu_irq;
793 814
    qemu_irq *isa_irq;
794 815
    qemu_irq *i8259;
816
    qemu_irq *cmos_s3;
817
    qemu_irq *smi_irq;
795 818
    IsaIrqState *isa_irq_state;
796 819
    DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
797 820
    DriveInfo *fd[MAX_FD];
......
1006 1029
        uint8_t *eeprom_buf = qemu_mallocz(8 * 256); /* XXX: make this persistent */
1007 1030
        i2c_bus *smbus;
1008 1031

  
1032
        cmos_s3 = qemu_allocate_irqs(cmos_set_s3_resume, rtc_state, 1);
1033
        smi_irq = qemu_allocate_irqs(acpi_smi_interrupt, first_cpu, 1);
1009 1034
        /* TODO: Populate SPD eeprom data.  */
1010 1035
        smbus = piix4_pm_init(pci_bus, piix3_devfn + 3, 0xb100,
1011
                              isa_reserve_irq(9));
1036
                              isa_reserve_irq(9), *cmos_s3, *smi_irq,
1037
                              kvm_enabled());
1012 1038
        for (i = 0; i < 8; i++) {
1013 1039
            DeviceState *eeprom;
1014 1040
            eeprom = qdev_create((BusState *)smbus, "smbus-eeprom");
......
1060 1086
             initrd_filename, cpu_model, 0);
1061 1087
}
1062 1088

  
1063
/* set CMOS shutdown status register (index 0xF) as S3_resume(0xFE)
1064
   BIOS will read it and start S3 resume at POST Entry */
1065
void cmos_set_s3_resume(void)
1066
{
1067
    if (rtc_state)
1068
        rtc_set_memory(rtc_state, 0xF, 0xFE);
1069
}
1070

  
1071 1089
static QEMUMachine pc_machine = {
1072 1090
    .name = "pc-0.13",
1073 1091
    .alias = "pc",
b/hw/pc.h
73 73
RTCState *rtc_init(int base_year);
74 74
void rtc_set_memory(RTCState *s, int addr, int val);
75 75
void rtc_set_date(RTCState *s, const struct tm *tm);
76
void cmos_set_s3_resume(void);
77 76

  
78 77
/* pc.c */
79 78
extern int fd_bootchk;
......
90 89
int acpi_table_add(const char *table_desc);
91 90

  
92 91
/* acpi_piix.c */
92

  
93 93
i2c_bus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
94
                       qemu_irq sci_irq);
94
                       qemu_irq sci_irq, qemu_irq cmos_s3, qemu_irq smi_irq,
95
                       int kvm_enabled);
95 96
void piix4_smbus_register_device(SMBusDevice *dev, uint8_t addr);
96 97
void piix4_acpi_system_hot_add_init(PCIBus *bus);
97 98

  

Also available in: Unified diff