* [Qemu-devel] [PATCH V11 00/27] split out piix specific part from pc emulator and some clean ups
@ 2010-01-05 6:27 Isaku Yamahata
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 01/27] acpi: split out pc smbus routines from acpi.c into pc_smbus.c Isaku Yamahata
` (27 more replies)
0 siblings, 28 replies; 32+ messages in thread
From: Isaku Yamahata @ 2010-01-05 6:27 UTC (permalink / raw)
To: qemu-devel, kraxel; +Cc: yamahata
Now I addressed the minor nits Gerd pointed out,
so now they are ready to commit, I think.
Anthony, can you please commit them?
Gerd, thank you for your review.
patch series description:
This is the preparation patch for q35 chipset and PCIE support.
This patch series is for spliting out piix specific part from pc emulator
to make it easier to implement other pc chipset emulator.
Although my motivation is for 128+ PCI and another chipset support,
I think this patch series itself is good for readability and maintenance.
thanks,
Changes from V10:
- pass DeviceState* to pc_smbus_init(), now info qtree shows smbus.
- change pci hotplug argument from void * to DeviceState*.
Changes from V9:
- rebased 502e64fe23f19c086d42f6178cdda19e58996080
- use qemu_irq to remove global variables, rtc_state
- make rtc_xxx functions accept/return ISADevice and related clean ups
- pci hot plug clean up
- removed #ifdef DEBUG patches.
Changes from V8:
- make rtc_xxx functions accept/return ISADevice.
- move up ioapic initalization patch.
- fixed up copyright notice.
Changes from V7:
- rebased to fe0d61231eb6be6a83c54f4a2795f924ee963f8f
Changes from v6:
- rebased to 731c54f86988d3f28268f184fabfe9b2a32fb5d3
Changes from v5:
- rebased 0.11.0-rc0
- changed qemu_system_powerdown_register() to call
qemu_system_shutdown_request() if qemu_system_shutdown() is called before
registering.
Changes from v4:
- fix version number.
- rebased anthony's staging tree whose latest change set is
62969268f876c547ee64da6d60e0f363e0f1df75
Changes from v3:
- move qemu_system_powerdown() in vl.c and more generic
following the comment by Marcelo Tosatti <mtosatti@redhat.com>
acpi.c: make qemu_system_powerdown() piix independent.
- define cmos_set_s3_resume_init() and cmos_set_s3_resume() in pc.c
even if TARGET_I386 isn't defined following th ecommit by
Paolo Bonzini <bonzini@gnu.org>
pc.c: remove a global variable, RTCState *rtc_state.
- minor compilation fixes
Changes from v2:
- clean up pc_pci_device_init() not to use unnecessary braces.
Changes from v1:
- make patches full bisectable
- typo s/allocte/allocate/
- some minor fixes
- dropped a merged patch
Isaku Yamahata (27):
acpi: split out pc smbus routines from acpi.c into pc_smbus.c
acpi: split out apm register emulation from acpi.c
acpi: add acpi constants from linux header files and use them.
acpi: split acpi.c into the common part and the piix4 part.
acpi_piix4: remove unused variable in get_pmsts().
pc: initialize ioapic before use.
pc, i440fx: Make smm enable/disable function i440fx independent.
pc: make an unnecessary global variable, pit, local.
pc: remove a global variable, floppy_controller.
pc: remove global variable rtc_state by using qemu_irq.
pc: introduce a function to allocate cpu irq.
pc: make pc_init1() not refer ferr_irq directly.
pc: split out cpu initialization from pc_init1() into pc_cpus_init().
pc: split out memory allocation from pc_init1() into pc_memory_init()
pc: split out vga initialization from pc_init1() into pc_vga_init().
pc: split out basic device init from pc_init1() into
pc_basic_device_init()
pc: split out pci device init from pc_init1() into
pc_pci_device_init()
pc: split out piix specific part from pc.c into pc_piix.c
pc: move rtc declarations from pc.h into a dedicated header file.
rtc: make rtc_xxx accept/return ISADevice instead of RTCState.
acpi_piix4: qdevfy.
pci hotplug: add argument to pci hot plug callback.
pci hotadd, acpi_piix4: remove global variables.
pc_smbus: remove #ifdef DEBUG.
acpi_piix4: remove #ifdef DEBUG.
pc_apm: remove #ifdef DEBUG.
mc146818rtc: remove #ifdef DEBUG_CMOS.
Makefile.target | 2 +
hw/acpi.c | 738 +-----------------------------------------------------
hw/acpi.h | 78 ++++++
hw/acpi_piix4.c | 596 +++++++++++++++++++++++++++++++++++++++++++
hw/mc146818rtc.c | 44 ++--
hw/mc146818rtc.h | 10 +
hw/mips_jazz.c | 1 +
hw/mips_malta.c | 6 +-
hw/mips_r4k.c | 3 +-
hw/pc.c | 350 ++++++++------------------
hw/pc.h | 57 ++++-
hw/pc_apm.c | 87 +++++++
hw/pc_apm.h | 22 ++
hw/pc_piix.c | 250 ++++++++++++++++++
hw/pc_smbus.c | 181 +++++++++++++
hw/pc_smbus.h | 21 ++
hw/pci.c | 8 +-
hw/pci.h | 4 +-
hw/piix_pci.c | 5 +-
hw/ppc_prep.c | 1 +
20 files changed, 1440 insertions(+), 1024 deletions(-)
create mode 100644 hw/acpi.h
create mode 100644 hw/acpi_piix4.c
create mode 100644 hw/mc146818rtc.h
create mode 100644 hw/pc_apm.c
create mode 100644 hw/pc_apm.h
create mode 100644 hw/pc_piix.c
create mode 100644 hw/pc_smbus.c
create mode 100644 hw/pc_smbus.h
^ permalink raw reply [flat|nested] 32+ messages in thread
* [Qemu-devel] [PATCH V11 01/27] acpi: split out pc smbus routines from acpi.c into pc_smbus.c
2010-01-05 6:27 [Qemu-devel] [PATCH V11 00/27] split out piix specific part from pc emulator and some clean ups Isaku Yamahata
@ 2010-01-05 6:27 ` Isaku Yamahata
2010-01-05 22:11 ` Aurelien Jarno
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 02/27] acpi: split out apm register emulation from acpi.c Isaku Yamahata
` (26 subsequent siblings)
27 siblings, 1 reply; 32+ messages in thread
From: Isaku Yamahata @ 2010-01-05 6:27 UTC (permalink / raw)
To: qemu-devel, kraxel; +Cc: yamahata
Split out pc smbus routines from acpi.c into pc_smbus.c and
use it.
The split out smbus emulation will be used later.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
changes v10 -> v11
- add DeviceState *qdev argument to pc_smbus_init()
for info qtree.
---
Makefile.target | 2 +
hw/acpi.c | 164 +++------------------------------------------------
hw/pc_smbus.c | 178 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
hw/pc_smbus.h | 21 +++++++
4 files changed, 209 insertions(+), 156 deletions(-)
create mode 100644 hw/pc_smbus.c
create mode 100644 hw/pc_smbus.h
diff --git a/Makefile.target b/Makefile.target
index 7c1f30c..2cde15f 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -195,6 +195,7 @@ obj-i386-y += cirrus_vga.o apic.o ioapic.o parallel.o acpi.o piix_pci.o
obj-i386-y += usb-uhci.o vmmouse.o vmport.o vmware_vga.o hpet.o
obj-i386-y += device-hotplug.o pci-hotplug.o smbios.o wdt_ib700.o
obj-i386-y += ne2000-isa.o
+obj-i386-y += pc_smbus.o
# shared objects
obj-ppc-y = ppc.o ide/core.o ide/qdev.o ide/isa.o ide/pci.o ide/macio.o
@@ -225,6 +226,7 @@ obj-mips-y += ide/core.o ide/qdev.o ide/isa.o ide/pci.o ide/piix.o
obj-mips-y += gt64xxx.o pckbd.o fdc.o mc146818rtc.o usb-uhci.o acpi.o ds1225y.o
obj-mips-y += piix4.o parallel.o cirrus_vga.o pcspk.o $(sound-obj-y)
obj-mips-y += mipsnet.o ne2000-isa.o
+obj-mips-y += pc_smbus.o
obj-mips-y += pflash_cfi01.o
obj-mips-y += vmware_vga.o
diff --git a/hw/acpi.c b/hw/acpi.c
index 9a69e7d..507b308 100644
--- a/hw/acpi.c
+++ b/hw/acpi.c
@@ -17,6 +17,7 @@
*/
#include "hw.h"
#include "pc.h"
+#include "pc_smbus.h"
#include "pci.h"
#include "qemu-timer.h"
#include "sysemu.h"
@@ -40,15 +41,9 @@ typedef struct PIIX4PMState {
uint8_t apms;
QEMUTimer *tmr_timer;
int64_t tmr_overflow_time;
- i2c_bus *smbus;
- uint8_t smb_stat;
- uint8_t smb_ctl;
- uint8_t smb_cmd;
- uint8_t smb_addr;
- uint8_t smb_data0;
- uint8_t smb_data1;
- uint8_t smb_data[32];
- uint8_t smb_index;
+
+ PCSMBus smb;
+
qemu_irq irq;
} PIIX4PMState;
@@ -66,14 +61,6 @@ typedef struct PIIX4PMState {
#define ACPI_ENABLE 0xf1
#define ACPI_DISABLE 0xf0
-#define SMBHSTSTS 0x00
-#define SMBHSTCNT 0x02
-#define SMBHSTCMD 0x03
-#define SMBHSTADD 0x04
-#define SMBHSTDAT0 0x05
-#define SMBHSTDAT1 0x06
-#define SMBBLKDAT 0x07
-
static PIIX4PMState *pm_state;
static uint32_t get_pmtmr(PIIX4PMState *s)
@@ -279,141 +266,6 @@ static void acpi_dbg_writel(void *opaque, uint32_t addr, uint32_t val)
#endif
}
-static void smb_transaction(PIIX4PMState *s)
-{
- uint8_t prot = (s->smb_ctl >> 2) & 0x07;
- uint8_t read = s->smb_addr & 0x01;
- uint8_t cmd = s->smb_cmd;
- uint8_t addr = s->smb_addr >> 1;
- i2c_bus *bus = s->smbus;
-
-#ifdef DEBUG
- printf("SMBus trans addr=0x%02x prot=0x%02x\n", addr, prot);
-#endif
- switch(prot) {
- case 0x0:
- smbus_quick_command(bus, addr, read);
- break;
- case 0x1:
- if (read) {
- s->smb_data0 = smbus_receive_byte(bus, addr);
- } else {
- smbus_send_byte(bus, addr, cmd);
- }
- break;
- case 0x2:
- if (read) {
- s->smb_data0 = smbus_read_byte(bus, addr, cmd);
- } else {
- smbus_write_byte(bus, addr, cmd, s->smb_data0);
- }
- break;
- case 0x3:
- if (read) {
- uint16_t val;
- val = smbus_read_word(bus, addr, cmd);
- s->smb_data0 = val;
- s->smb_data1 = val >> 8;
- } else {
- smbus_write_word(bus, addr, cmd, (s->smb_data1 << 8) | s->smb_data0);
- }
- break;
- case 0x5:
- if (read) {
- s->smb_data0 = smbus_read_block(bus, addr, cmd, s->smb_data);
- } else {
- smbus_write_block(bus, addr, cmd, s->smb_data, s->smb_data0);
- }
- break;
- default:
- goto error;
- }
- return;
-
- error:
- s->smb_stat |= 0x04;
-}
-
-static void smb_ioport_writeb(void *opaque, uint32_t addr, uint32_t val)
-{
- PIIX4PMState *s = opaque;
- addr &= 0x3f;
-#ifdef DEBUG
- printf("SMB writeb port=0x%04x val=0x%02x\n", addr, val);
-#endif
- switch(addr) {
- case SMBHSTSTS:
- s->smb_stat = 0;
- s->smb_index = 0;
- break;
- case SMBHSTCNT:
- s->smb_ctl = val;
- if (val & 0x40)
- smb_transaction(s);
- break;
- case SMBHSTCMD:
- s->smb_cmd = val;
- break;
- case SMBHSTADD:
- s->smb_addr = val;
- break;
- case SMBHSTDAT0:
- s->smb_data0 = val;
- break;
- case SMBHSTDAT1:
- s->smb_data1 = val;
- break;
- case SMBBLKDAT:
- s->smb_data[s->smb_index++] = val;
- if (s->smb_index > 31)
- s->smb_index = 0;
- break;
- default:
- break;
- }
-}
-
-static uint32_t smb_ioport_readb(void *opaque, uint32_t addr)
-{
- PIIX4PMState *s = opaque;
- uint32_t val;
-
- addr &= 0x3f;
- switch(addr) {
- case SMBHSTSTS:
- val = s->smb_stat;
- break;
- case SMBHSTCNT:
- s->smb_index = 0;
- val = s->smb_ctl & 0x1f;
- break;
- case SMBHSTCMD:
- val = s->smb_cmd;
- break;
- case SMBHSTADD:
- val = s->smb_addr;
- break;
- case SMBHSTDAT0:
- val = s->smb_data0;
- break;
- case SMBHSTDAT1:
- val = s->smb_data1;
- break;
- case SMBBLKDAT:
- val = s->smb_data[s->smb_index++];
- if (s->smb_index > 31)
- s->smb_index = 0;
- break;
- default:
- val = 0;
- break;
- }
-#ifdef DEBUG
- printf("SMB readb port=0x%04x val=0x%02x\n", addr, val);
-#endif
- return val;
-}
-
static void pm_io_space_update(PIIX4PMState *s)
{
uint32_t pm_io_base;
@@ -542,8 +394,8 @@ i2c_bus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
pci_conf[0x90] = smb_io_base | 1;
pci_conf[0x91] = smb_io_base >> 8;
pci_conf[0xd2] = 0x09;
- register_ioport_write(smb_io_base, 64, 1, smb_ioport_writeb, s);
- register_ioport_read(smb_io_base, 64, 1, smb_ioport_readb, s);
+ register_ioport_write(smb_io_base, 64, 1, smb_ioport_writeb, &s->smb);
+ register_ioport_read(smb_io_base, 64, 1, smb_ioport_readb, &s->smb);
s->tmr_timer = qemu_new_timer(vm_clock, pm_tmr_timer, s);
@@ -551,11 +403,11 @@ i2c_bus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
vmstate_register(0, &vmstate_acpi, s);
- s->smbus = i2c_init_bus(NULL, "i2c");
+ pc_smbus_init(NULL, &s->smb);
s->irq = sci_irq;
qemu_register_reset(piix4_reset, s);
- return s->smbus;
+ return s->smb.smbus;
}
#define GPE_BASE 0xafe0
diff --git a/hw/pc_smbus.c b/hw/pc_smbus.c
new file mode 100644
index 0000000..30cdaa7
--- /dev/null
+++ b/hw/pc_smbus.c
@@ -0,0 +1,178 @@
+/*
+ * PC SMBus implementation
+ * splitted from acpi.c
+ *
+ * Copyright (c) 2006 Fabrice Bellard
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA
+ */
+#include "hw.h"
+#include "pc.h"
+#include "pc_smbus.h"
+#include "pci.h"
+#include "qemu-timer.h"
+#include "sysemu.h"
+#include "i2c.h"
+#include "smbus.h"
+#include "kvm.h"
+
+/* no save/load? */
+
+#define SMBHSTSTS 0x00
+#define SMBHSTCNT 0x02
+#define SMBHSTCMD 0x03
+#define SMBHSTADD 0x04
+#define SMBHSTDAT0 0x05
+#define SMBHSTDAT1 0x06
+#define SMBBLKDAT 0x07
+
+static void smb_transaction(PCSMBus *s)
+{
+ uint8_t prot = (s->smb_ctl >> 2) & 0x07;
+ uint8_t read = s->smb_addr & 0x01;
+ uint8_t cmd = s->smb_cmd;
+ uint8_t addr = s->smb_addr >> 1;
+ i2c_bus *bus = s->smbus;
+
+#ifdef DEBUG
+ printf("SMBus trans addr=0x%02x prot=0x%02x\n", addr, prot);
+#endif
+ switch(prot) {
+ case 0x0:
+ smbus_quick_command(bus, addr, read);
+ break;
+ case 0x1:
+ if (read) {
+ s->smb_data0 = smbus_receive_byte(bus, addr);
+ } else {
+ smbus_send_byte(bus, addr, cmd);
+ }
+ break;
+ case 0x2:
+ if (read) {
+ s->smb_data0 = smbus_read_byte(bus, addr, cmd);
+ } else {
+ smbus_write_byte(bus, addr, cmd, s->smb_data0);
+ }
+ break;
+ case 0x3:
+ if (read) {
+ uint16_t val;
+ val = smbus_read_word(bus, addr, cmd);
+ s->smb_data0 = val;
+ s->smb_data1 = val >> 8;
+ } else {
+ smbus_write_word(bus, addr, cmd, (s->smb_data1 << 8) | s->smb_data0);
+ }
+ break;
+ case 0x5:
+ if (read) {
+ s->smb_data0 = smbus_read_block(bus, addr, cmd, s->smb_data);
+ } else {
+ smbus_write_block(bus, addr, cmd, s->smb_data, s->smb_data0);
+ }
+ break;
+ default:
+ goto error;
+ }
+ return;
+
+ error:
+ s->smb_stat |= 0x04;
+}
+
+void smb_ioport_writeb(void *opaque, uint32_t addr, uint32_t val)
+{
+ PCSMBus *s = opaque;
+ addr &= 0x3f;
+#ifdef DEBUG
+ printf("SMB writeb port=0x%04x val=0x%02x\n", addr, val);
+#endif
+ switch(addr) {
+ case SMBHSTSTS:
+ s->smb_stat = 0;
+ s->smb_index = 0;
+ break;
+ case SMBHSTCNT:
+ s->smb_ctl = val;
+ if (val & 0x40)
+ smb_transaction(s);
+ break;
+ case SMBHSTCMD:
+ s->smb_cmd = val;
+ break;
+ case SMBHSTADD:
+ s->smb_addr = val;
+ break;
+ case SMBHSTDAT0:
+ s->smb_data0 = val;
+ break;
+ case SMBHSTDAT1:
+ s->smb_data1 = val;
+ break;
+ case SMBBLKDAT:
+ s->smb_data[s->smb_index++] = val;
+ if (s->smb_index > 31)
+ s->smb_index = 0;
+ break;
+ default:
+ break;
+ }
+}
+
+uint32_t smb_ioport_readb(void *opaque, uint32_t addr)
+{
+ PCSMBus *s = opaque;
+ uint32_t val;
+
+ addr &= 0x3f;
+ switch(addr) {
+ case SMBHSTSTS:
+ val = s->smb_stat;
+ break;
+ case SMBHSTCNT:
+ s->smb_index = 0;
+ val = s->smb_ctl & 0x1f;
+ break;
+ case SMBHSTCMD:
+ val = s->smb_cmd;
+ break;
+ case SMBHSTADD:
+ val = s->smb_addr;
+ break;
+ case SMBHSTDAT0:
+ val = s->smb_data0;
+ break;
+ case SMBHSTDAT1:
+ val = s->smb_data1;
+ break;
+ case SMBBLKDAT:
+ val = s->smb_data[s->smb_index++];
+ if (s->smb_index > 31)
+ s->smb_index = 0;
+ break;
+ default:
+ val = 0;
+ break;
+ }
+#ifdef DEBUG
+ printf("SMB readb port=0x%04x val=0x%02x\n", addr, val);
+#endif
+ return val;
+}
+
+void pc_smbus_init(DeviceState *parent, PCSMBus *smb)
+{
+ smb->smbus = i2c_init_bus(parent, "i2c");
+}
diff --git a/hw/pc_smbus.h b/hw/pc_smbus.h
new file mode 100644
index 0000000..27c0eec
--- /dev/null
+++ b/hw/pc_smbus.h
@@ -0,0 +1,21 @@
+#ifndef PC_SMBUS_H
+#define PC_SMBUS_H
+
+typedef struct PCSMBus {
+ i2c_bus *smbus;
+
+ uint8_t smb_stat;
+ uint8_t smb_ctl;
+ uint8_t smb_cmd;
+ uint8_t smb_addr;
+ uint8_t smb_data0;
+ uint8_t smb_data1;
+ uint8_t smb_data[32];
+ uint8_t smb_index;
+} PCSMBus;
+
+void pc_smbus_init(DeviceState *parent, PCSMBus *smb);
+void smb_ioport_writeb(void *opaque, uint32_t addr, uint32_t val);
+uint32_t smb_ioport_readb(void *opaque, uint32_t addr);
+
+#endif /* !PC_SMBUS_H */
--
1.6.5.4
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [Qemu-devel] [PATCH V11 02/27] acpi: split out apm register emulation from acpi.c
2010-01-05 6:27 [Qemu-devel] [PATCH V11 00/27] split out piix specific part from pc emulator and some clean ups Isaku Yamahata
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 01/27] acpi: split out pc smbus routines from acpi.c into pc_smbus.c Isaku Yamahata
@ 2010-01-05 6:27 ` Isaku Yamahata
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 03/27] acpi: add acpi constants from linux header files and use them Isaku Yamahata
` (25 subsequent siblings)
27 siblings, 0 replies; 32+ messages in thread
From: Isaku Yamahata @ 2010-01-05 6:27 UTC (permalink / raw)
To: qemu-devel, kraxel; +Cc: yamahata
Split out apm register emulation for acpi.c into pc_apm.c.
The apm emulation will be used later.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
Makefile.target | 4 +-
hw/acpi.c | 57 ++++++++++--------------------------
hw/pc_apm.c | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
hw/pc_apm.h | 22 ++++++++++++++
4 files changed, 125 insertions(+), 43 deletions(-)
create mode 100644 hw/pc_apm.c
create mode 100644 hw/pc_apm.h
diff --git a/Makefile.target b/Makefile.target
index 2cde15f..94ab0ec 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -195,7 +195,7 @@ obj-i386-y += cirrus_vga.o apic.o ioapic.o parallel.o acpi.o piix_pci.o
obj-i386-y += usb-uhci.o vmmouse.o vmport.o vmware_vga.o hpet.o
obj-i386-y += device-hotplug.o pci-hotplug.o smbios.o wdt_ib700.o
obj-i386-y += ne2000-isa.o
-obj-i386-y += pc_smbus.o
+obj-i386-y += pc_smbus.o pc_apm.o
# shared objects
obj-ppc-y = ppc.o ide/core.o ide/qdev.o ide/isa.o ide/pci.o ide/macio.o
@@ -226,7 +226,7 @@ obj-mips-y += ide/core.o ide/qdev.o ide/isa.o ide/pci.o ide/piix.o
obj-mips-y += gt64xxx.o pckbd.o fdc.o mc146818rtc.o usb-uhci.o acpi.o ds1225y.o
obj-mips-y += piix4.o parallel.o cirrus_vga.o pcspk.o $(sound-obj-y)
obj-mips-y += mipsnet.o ne2000-isa.o
-obj-mips-y += pc_smbus.o
+obj-mips-y += pc_smbus.o pc_apm.o
obj-mips-y += pflash_cfi01.o
obj-mips-y += vmware_vga.o
diff --git a/hw/acpi.c b/hw/acpi.c
index 507b308..0e2f576 100644
--- a/hw/acpi.c
+++ b/hw/acpi.c
@@ -17,6 +17,7 @@
*/
#include "hw.h"
#include "pc.h"
+#include "pc_apm.h"
#include "pc_smbus.h"
#include "pci.h"
#include "qemu-timer.h"
@@ -37,8 +38,9 @@ typedef struct PIIX4PMState {
uint16_t pmsts;
uint16_t pmen;
uint16_t pmcntrl;
- uint8_t apmc;
- uint8_t apms;
+
+ APMState apm;
+
QEMUTimer *tmr_timer;
int64_t tmr_overflow_time;
@@ -217,46 +219,20 @@ static uint32_t pm_ioport_readl(void *opaque, uint32_t addr)
return val;
}
-static void pm_smi_writeb(void *opaque, uint32_t addr, uint32_t val)
+static void apm_ctrl_changed(uint32_t val, void *arg)
{
- PIIX4PMState *s = opaque;
- addr &= 1;
-#ifdef DEBUG
- printf("pm_smi_writeb addr=0x%x val=0x%02x\n", addr, val);
-#endif
- if (addr == 0) {
- s->apmc = val;
-
- /* ACPI specs 3.0, 4.7.2.5 */
- if (val == ACPI_ENABLE) {
- s->pmcntrl |= SCI_EN;
- } else if (val == ACPI_DISABLE) {
- s->pmcntrl &= ~SCI_EN;
- }
+ PIIX4PMState *s = arg;
- if (s->dev.config[0x5b] & (1 << 1)) {
- cpu_interrupt(first_cpu, CPU_INTERRUPT_SMI);
- }
- } else {
- s->apms = val;
+ /* ACPI specs 3.0, 4.7.2.5 */
+ if (val == ACPI_ENABLE) {
+ s->pmcntrl |= SCI_EN;
+ } else if (val == ACPI_DISABLE) {
+ s->pmcntrl &= ~SCI_EN;
}
-}
-static uint32_t pm_smi_readb(void *opaque, uint32_t addr)
-{
- PIIX4PMState *s = opaque;
- uint32_t val;
-
- addr &= 1;
- if (addr == 0) {
- val = s->apmc;
- } else {
- val = s->apms;
+ if (s->dev.config[0x5b] & (1 << 1)) {
+ cpu_interrupt(first_cpu, CPU_INTERRUPT_SMI);
}
-#ifdef DEBUG
- printf("pm_smi_readb addr=0x%x val=0x%02x\n", addr, val);
-#endif
- return val;
}
static void acpi_dbg_writel(void *opaque, uint32_t addr, uint32_t val)
@@ -312,8 +288,7 @@ static const VMStateDescription vmstate_acpi = {
VMSTATE_UINT16(pmsts, PIIX4PMState),
VMSTATE_UINT16(pmen, PIIX4PMState),
VMSTATE_UINT16(pmcntrl, PIIX4PMState),
- VMSTATE_UINT8(apmc, PIIX4PMState),
- VMSTATE_UINT8(apms, PIIX4PMState),
+ VMSTATE_STRUCT(apm, PIIX4PMState, 0, vmstate_pc_apm, APMState),
VMSTATE_TIMER(tmr_timer, PIIX4PMState),
VMSTATE_INT64(tmr_overflow_time, PIIX4PMState),
VMSTATE_END_OF_LIST()
@@ -373,8 +348,8 @@ i2c_bus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
pci_conf[0x40] = 0x01; /* PM io base read only bit */
- register_ioport_write(0xb2, 2, 1, pm_smi_writeb, s);
- register_ioport_read(0xb2, 2, 1, pm_smi_readb, s);
+ /* APM */
+ apm_init(&s->apm, apm_ctrl_changed, s);
register_ioport_write(ACPI_DBG_IO_ADDR, 4, 4, acpi_dbg_writel, s);
diff --git a/hw/pc_apm.c b/hw/pc_apm.c
new file mode 100644
index 0000000..f6bcd7d
--- /dev/null
+++ b/hw/pc_apm.c
@@ -0,0 +1,85 @@
+/*
+ * QEMU PC APM controller Emulation
+ * This is split out from acpi.c
+ *
+ * Copyright (c) 2006 Fabrice Bellard
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>
+ */
+
+#include "pc_apm.h"
+#include "hw.h"
+#include "isa.h"
+
+//#define DEBUG
+
+/* fixed I/O location */
+#define APM_CNT_IOPORT 0xb2
+#define APM_STS_IOPORT 0xb3
+
+static void apm_ioport_writeb(void *opaque, uint32_t addr, uint32_t val)
+{
+ APMState *apm = opaque;
+ addr &= 1;
+#ifdef DEBUG
+ printf("apm_ioport_writeb addr=0x%x val=0x%02x\n", addr, val);
+#endif
+ if (addr == 0) {
+ apm->apmc = val;
+
+ if (apm->callback) {
+ (apm->callback)(val, apm->arg);
+ }
+ } else {
+ apm->apms = val;
+ }
+}
+
+static uint32_t apm_ioport_readb(void *opaque, uint32_t addr)
+{
+ APMState *apm = opaque;
+ uint32_t val;
+
+ addr &= 1;
+ if (addr == 0) {
+ val = apm->apmc;
+ } else {
+ val = apm->apms;
+ }
+#ifdef DEBUG
+ printf("apm_ioport_readb addr=0x%x val=0x%02x\n", addr, val);
+#endif
+ return val;
+}
+
+const VMStateDescription vmstate_pc_apm = {
+ .name = "PC APM State",
+ .version_id = 1,
+ .minimum_version_id = 1,
+ .minimum_version_id_old = 1,
+ .fields = (VMStateField[]) {
+ VMSTATE_UINT8(apmc, APMState),
+ VMSTATE_UINT8(apms, APMState),
+ VMSTATE_END_OF_LIST()
+ }
+};
+
+void apm_init(APMState *apm, apm_ctrl_changed_t callback, void *arg)
+{
+ apm->callback = callback;
+ apm->arg = arg;
+
+ /* ioport 0xb2, 0xb3 */
+ register_ioport_write(APM_CNT_IOPORT, 2, 1, apm_ioport_writeb, apm);
+ register_ioport_read(APM_CNT_IOPORT, 2, 1, apm_ioport_readb, apm);
+}
diff --git a/hw/pc_apm.h b/hw/pc_apm.h
new file mode 100644
index 0000000..e8ff034
--- /dev/null
+++ b/hw/pc_apm.h
@@ -0,0 +1,22 @@
+#ifndef PC_APM_H
+#define PC_APM_H
+
+#include <stdint.h>
+#include "qemu-common.h"
+#include "hw.h"
+
+typedef void (*apm_ctrl_changed_t)(uint32_t val, void *arg);
+
+typedef struct APMState {
+ uint8_t apmc;
+ uint8_t apms;
+
+ apm_ctrl_changed_t callback;
+ void *arg;
+} APMState;
+
+void apm_init(APMState *s, apm_ctrl_changed_t callback, void *arg);
+
+extern const VMStateDescription vmstate_pc_apm;
+
+#endif /* PC_APM_H */
--
1.6.5.4
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [Qemu-devel] [PATCH V11 03/27] acpi: add acpi constants from linux header files and use them.
2010-01-05 6:27 [Qemu-devel] [PATCH V11 00/27] split out piix specific part from pc emulator and some clean ups Isaku Yamahata
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 01/27] acpi: split out pc smbus routines from acpi.c into pc_smbus.c Isaku Yamahata
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 02/27] acpi: split out apm register emulation from acpi.c Isaku Yamahata
@ 2010-01-05 6:27 ` Isaku Yamahata
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 04/27] acpi: split acpi.c into the common part and the piix4 part Isaku Yamahata
` (24 subsequent siblings)
27 siblings, 0 replies; 32+ messages in thread
From: Isaku Yamahata @ 2010-01-05 6:27 UTC (permalink / raw)
To: qemu-devel, kraxel; +Cc: yamahata
add acpi constants from linux header files and
replace the old constants with them.
The acpi constants will be used by other file.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
hw/acpi.c | 56 +++++++++++++++++++------------------------
hw/acpi.h | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 103 insertions(+), 31 deletions(-)
create mode 100644 hw/acpi.h
diff --git a/hw/acpi.c b/hw/acpi.c
index 0e2f576..b83f8e6 100644
--- a/hw/acpi.c
+++ b/hw/acpi.c
@@ -25,12 +25,10 @@
#include "i2c.h"
#include "smbus.h"
#include "kvm.h"
+#include "acpi.h"
//#define DEBUG
-/* i82731AB (PIIX4) compatible power management function */
-#define PM_FREQ 3579545
-
#define ACPI_DBG_IO_ADDR 0xb044
typedef struct PIIX4PMState {
@@ -49,17 +47,6 @@ typedef struct PIIX4PMState {
qemu_irq irq;
} PIIX4PMState;
-#define RSM_STS (1 << 15)
-#define PWRBTN_STS (1 << 8)
-#define RTC_EN (1 << 10)
-#define PWRBTN_EN (1 << 8)
-#define GBL_EN (1 << 5)
-#define TMROF_EN (1 << 0)
-
-#define SCI_EN (1 << 0)
-
-#define SUS_EN (1 << 13)
-
#define ACPI_ENABLE 0xf1
#define ACPI_DISABLE 0xf0
@@ -68,7 +55,7 @@ static PIIX4PMState *pm_state;
static uint32_t get_pmtmr(PIIX4PMState *s)
{
uint32_t d;
- d = muldiv64(qemu_get_clock(vm_clock), PM_FREQ, get_ticks_per_sec());
+ d = muldiv64(qemu_get_clock(vm_clock), PM_TIMER_FREQUENCY, get_ticks_per_sec());
return d & 0xffffff;
}
@@ -77,9 +64,10 @@ static int get_pmsts(PIIX4PMState *s)
int64_t d;
int pmsts;
pmsts = s->pmsts;
- d = muldiv64(qemu_get_clock(vm_clock), PM_FREQ, get_ticks_per_sec());
+ d = muldiv64(qemu_get_clock(vm_clock), PM_TIMER_FREQUENCY,
+ get_ticks_per_sec());
if (d >= s->tmr_overflow_time)
- s->pmsts |= TMROF_EN;
+ s->pmsts |= ACPI_BITMASK_TIMER_STATUS;
return s->pmsts;
}
@@ -90,11 +78,16 @@ static void pm_update_sci(PIIX4PMState *s)
pmsts = get_pmsts(s);
sci_level = (((pmsts & s->pmen) &
- (RTC_EN | PWRBTN_EN | GBL_EN | TMROF_EN)) != 0);
+ (ACPI_BITMASK_RT_CLOCK_ENABLE |
+ ACPI_BITMASK_POWER_BUTTON_ENABLE |
+ ACPI_BITMASK_GLOBAL_LOCK_ENABLE |
+ ACPI_BITMASK_TIMER_ENABLE)) != 0);
qemu_set_irq(s->irq, sci_level);
/* schedule a timer interruption if needed */
- if ((s->pmen & TMROF_EN) && !(pmsts & TMROF_EN)) {
- expire_time = muldiv64(s->tmr_overflow_time, get_ticks_per_sec(), PM_FREQ);
+ if ((s->pmen & ACPI_BITMASK_TIMER_ENABLE) &&
+ !(pmsts & ACPI_BITMASK_TIMER_STATUS)) {
+ expire_time = muldiv64(s->tmr_overflow_time, get_ticks_per_sec(),
+ PM_TIMER_FREQUENCY);
qemu_mod_timer(s->tmr_timer, expire_time);
} else {
qemu_del_timer(s->tmr_timer);
@@ -117,9 +110,9 @@ static void pm_ioport_writew(void *opaque, uint32_t addr, uint32_t val)
int64_t d;
int pmsts;
pmsts = get_pmsts(s);
- if (pmsts & val & TMROF_EN) {
+ if (pmsts & val & ACPI_BITMASK_TIMER_STATUS) {
/* if TMRSTS is reset, then compute the new overflow time */
- d = muldiv64(qemu_get_clock(vm_clock), PM_FREQ,
+ d = muldiv64(qemu_get_clock(vm_clock), PM_TIMER_FREQUENCY,
get_ticks_per_sec());
s->tmr_overflow_time = (d + 0x800000LL) & ~0x7fffffLL;
}
@@ -134,8 +127,8 @@ static void pm_ioport_writew(void *opaque, uint32_t addr, uint32_t val)
case 0x04:
{
int sus_typ;
- s->pmcntrl = val & ~(SUS_EN);
- if (val & SUS_EN) {
+ s->pmcntrl = val & ~(ACPI_BITMASK_SLEEP_ENABLE);
+ if (val & ACPI_BITMASK_SLEEP_ENABLE) {
/* change suspend type */
sus_typ = (val >> 10) & 7;
switch(sus_typ) {
@@ -143,9 +136,10 @@ static void pm_ioport_writew(void *opaque, uint32_t addr, uint32_t val)
qemu_system_shutdown_request();
break;
case 1:
- /* RSM_STS should be set on resume. Pretend that resume
- was caused by power button */
- s->pmsts |= (RSM_STS | PWRBTN_STS);
+ /* ACPI_BITMASK_WAKE_STATUS should be set on resume.
+ Pretend that resume was caused by power button */
+ s->pmsts |= (ACPI_BITMASK_WAKE_STATUS |
+ ACPI_BITMASK_POWER_BUTTON_STATUS);
qemu_system_reset_request();
#if defined(TARGET_I386)
cmos_set_s3_resume();
@@ -225,9 +219,9 @@ static void apm_ctrl_changed(uint32_t val, void *arg)
/* ACPI specs 3.0, 4.7.2.5 */
if (val == ACPI_ENABLE) {
- s->pmcntrl |= SCI_EN;
+ s->pmcntrl |= ACPI_BITMASK_SCI_ENABLE;
} else if (val == ACPI_DISABLE) {
- s->pmcntrl &= ~SCI_EN;
+ s->pmcntrl &= ~ACPI_BITMASK_SCI_ENABLE;
}
if (s->dev.config[0x5b] & (1 << 1)) {
@@ -318,8 +312,8 @@ static void piix4_powerdown(void *opaque, int irq, int power_failing)
if (!s) {
qemu_system_shutdown_request();
- } else if (s->pmen & PWRBTN_EN) {
- s->pmsts |= PWRBTN_EN;
+ } else if (s->pmen & ACPI_BITMASK_POWER_BUTTON_ENABLE) {
+ s->pmsts |= ACPI_BITMASK_POWER_BUTTON_STATUS;
pm_update_sci(s);
}
#endif
diff --git a/hw/acpi.h b/hw/acpi.h
new file mode 100644
index 0000000..51b56b6
--- /dev/null
+++ b/hw/acpi.h
@@ -0,0 +1,78 @@
+#ifndef QEMU_HW_ACPI_H
+#define QEMU_HW_ACPI_H
+/*
+ * Copyright (c) 2009 Isaku Yamahata <yamahata at valinux co jp>
+ * VA Linux Systems Japan K.K.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA
+ */
+
+/* from linux include/acpi/actype.h */
+/* Default ACPI register widths */
+
+#define ACPI_GPE_REGISTER_WIDTH 8
+#define ACPI_PM1_REGISTER_WIDTH 16
+#define ACPI_PM2_REGISTER_WIDTH 8
+#define ACPI_PM_TIMER_WIDTH 32
+
+/* PM Timer ticks per second (HZ) */
+#define PM_TIMER_FREQUENCY 3579545
+
+
+/* ACPI fixed hardware registers */
+
+/* from linux/drivers/acpi/acpica/aclocal.h */
+/* Masks used to access the bit_registers */
+
+/* PM1x_STS */
+#define ACPI_BITMASK_TIMER_STATUS 0x0001
+#define ACPI_BITMASK_BUS_MASTER_STATUS 0x0010
+#define ACPI_BITMASK_GLOBAL_LOCK_STATUS 0x0020
+#define ACPI_BITMASK_POWER_BUTTON_STATUS 0x0100
+#define ACPI_BITMASK_SLEEP_BUTTON_STATUS 0x0200
+#define ACPI_BITMASK_RT_CLOCK_STATUS 0x0400
+#define ACPI_BITMASK_PCIEXP_WAKE_STATUS 0x4000 /* ACPI 3.0 */
+#define ACPI_BITMASK_WAKE_STATUS 0x8000
+
+#define ACPI_BITMASK_ALL_FIXED_STATUS (\
+ ACPI_BITMASK_TIMER_STATUS | \
+ ACPI_BITMASK_BUS_MASTER_STATUS | \
+ ACPI_BITMASK_GLOBAL_LOCK_STATUS | \
+ ACPI_BITMASK_POWER_BUTTON_STATUS | \
+ ACPI_BITMASK_SLEEP_BUTTON_STATUS | \
+ ACPI_BITMASK_RT_CLOCK_STATUS | \
+ ACPI_BITMASK_WAKE_STATUS)
+
+/* PM1x_EN */
+#define ACPI_BITMASK_TIMER_ENABLE 0x0001
+#define ACPI_BITMASK_GLOBAL_LOCK_ENABLE 0x0020
+#define ACPI_BITMASK_POWER_BUTTON_ENABLE 0x0100
+#define ACPI_BITMASK_SLEEP_BUTTON_ENABLE 0x0200
+#define ACPI_BITMASK_RT_CLOCK_ENABLE 0x0400
+#define ACPI_BITMASK_PCIEXP_WAKE_DISABLE 0x4000 /* ACPI 3.0 */
+
+/* PM1x_CNT */
+#define ACPI_BITMASK_SCI_ENABLE 0x0001
+#define ACPI_BITMASK_BUS_MASTER_RLD 0x0002
+#define ACPI_BITMASK_GLOBAL_LOCK_RELEASE 0x0004
+#define ACPI_BITMASK_SLEEP_TYPE 0x1C00
+#define ACPI_BITMASK_SLEEP_ENABLE 0x2000
+
+/* PM2_CNT */
+#define ACPI_BITMASK_ARB_DISABLE 0x0001
+
+/* PM_TMR */
+
+#endif /* !QEMU_HW_ACPI_H */
--
1.6.5.4
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [Qemu-devel] [PATCH V11 04/27] acpi: split acpi.c into the common part and the piix4 part.
2010-01-05 6:27 [Qemu-devel] [PATCH V11 00/27] split out piix specific part from pc emulator and some clean ups Isaku Yamahata
` (2 preceding siblings ...)
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 03/27] acpi: add acpi constants from linux header files and use them Isaku Yamahata
@ 2010-01-05 6:27 ` Isaku Yamahata
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 05/27] acpi_piix4: remove unused variable in get_pmsts() Isaku Yamahata
` (23 subsequent siblings)
27 siblings, 0 replies; 32+ messages in thread
From: Isaku Yamahata @ 2010-01-05 6:27 UTC (permalink / raw)
To: qemu-devel, kraxel; +Cc: yamahata
Split acpi.c into the common part and the piix4 specific part.
The common part will be used later.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
Makefile.target | 4 +-
hw/acpi.c | 557 -------------------------------------------
hw/{acpi.c => acpi_piix4.c} | 172 +-------------
3 files changed, 4 insertions(+), 729 deletions(-)
copy hw/{acpi.c => acpi_piix4.c} (76%)
diff --git a/Makefile.target b/Makefile.target
index 94ab0ec..cf82ebf 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -195,7 +195,7 @@ obj-i386-y += cirrus_vga.o apic.o ioapic.o parallel.o acpi.o piix_pci.o
obj-i386-y += usb-uhci.o vmmouse.o vmport.o vmware_vga.o hpet.o
obj-i386-y += device-hotplug.o pci-hotplug.o smbios.o wdt_ib700.o
obj-i386-y += ne2000-isa.o
-obj-i386-y += pc_smbus.o pc_apm.o
+obj-i386-y += pc_smbus.o pc_apm.o acpi_piix4.o
# shared objects
obj-ppc-y = ppc.o ide/core.o ide/qdev.o ide/isa.o ide/pci.o ide/macio.o
@@ -226,7 +226,7 @@ obj-mips-y += ide/core.o ide/qdev.o ide/isa.o ide/pci.o ide/piix.o
obj-mips-y += gt64xxx.o pckbd.o fdc.o mc146818rtc.o usb-uhci.o acpi.o ds1225y.o
obj-mips-y += piix4.o parallel.o cirrus_vga.o pcspk.o $(sound-obj-y)
obj-mips-y += mipsnet.o ne2000-isa.o
-obj-mips-y += pc_smbus.o pc_apm.o
+obj-mips-y += pc_smbus.o pc_apm.o acpi_piix4.o
obj-mips-y += pflash_cfi01.o
obj-mips-y += vmware_vga.o
diff --git a/hw/acpi.c b/hw/acpi.c
index b83f8e6..4c4df56 100644
--- a/hw/acpi.c
+++ b/hw/acpi.c
@@ -17,567 +17,10 @@
*/
#include "hw.h"
#include "pc.h"
-#include "pc_apm.h"
-#include "pc_smbus.h"
#include "pci.h"
-#include "qemu-timer.h"
#include "sysemu.h"
-#include "i2c.h"
-#include "smbus.h"
-#include "kvm.h"
#include "acpi.h"
-//#define DEBUG
-
-#define ACPI_DBG_IO_ADDR 0xb044
-
-typedef struct PIIX4PMState {
- PCIDevice dev;
- uint16_t pmsts;
- uint16_t pmen;
- uint16_t pmcntrl;
-
- APMState apm;
-
- QEMUTimer *tmr_timer;
- int64_t tmr_overflow_time;
-
- PCSMBus smb;
-
- qemu_irq irq;
-} PIIX4PMState;
-
-#define ACPI_ENABLE 0xf1
-#define ACPI_DISABLE 0xf0
-
-static PIIX4PMState *pm_state;
-
-static uint32_t get_pmtmr(PIIX4PMState *s)
-{
- uint32_t d;
- d = muldiv64(qemu_get_clock(vm_clock), PM_TIMER_FREQUENCY, get_ticks_per_sec());
- return d & 0xffffff;
-}
-
-static int get_pmsts(PIIX4PMState *s)
-{
- int64_t d;
- int pmsts;
- pmsts = s->pmsts;
- d = muldiv64(qemu_get_clock(vm_clock), PM_TIMER_FREQUENCY,
- get_ticks_per_sec());
- if (d >= s->tmr_overflow_time)
- s->pmsts |= ACPI_BITMASK_TIMER_STATUS;
- return s->pmsts;
-}
-
-static void pm_update_sci(PIIX4PMState *s)
-{
- int sci_level, pmsts;
- int64_t expire_time;
-
- pmsts = get_pmsts(s);
- sci_level = (((pmsts & s->pmen) &
- (ACPI_BITMASK_RT_CLOCK_ENABLE |
- ACPI_BITMASK_POWER_BUTTON_ENABLE |
- ACPI_BITMASK_GLOBAL_LOCK_ENABLE |
- ACPI_BITMASK_TIMER_ENABLE)) != 0);
- qemu_set_irq(s->irq, sci_level);
- /* schedule a timer interruption if needed */
- if ((s->pmen & ACPI_BITMASK_TIMER_ENABLE) &&
- !(pmsts & ACPI_BITMASK_TIMER_STATUS)) {
- expire_time = muldiv64(s->tmr_overflow_time, get_ticks_per_sec(),
- PM_TIMER_FREQUENCY);
- qemu_mod_timer(s->tmr_timer, expire_time);
- } else {
- qemu_del_timer(s->tmr_timer);
- }
-}
-
-static void pm_tmr_timer(void *opaque)
-{
- PIIX4PMState *s = opaque;
- pm_update_sci(s);
-}
-
-static void pm_ioport_writew(void *opaque, uint32_t addr, uint32_t val)
-{
- PIIX4PMState *s = opaque;
- addr &= 0x3f;
- switch(addr) {
- case 0x00:
- {
- int64_t d;
- int pmsts;
- pmsts = get_pmsts(s);
- if (pmsts & val & ACPI_BITMASK_TIMER_STATUS) {
- /* if TMRSTS is reset, then compute the new overflow time */
- d = muldiv64(qemu_get_clock(vm_clock), PM_TIMER_FREQUENCY,
- get_ticks_per_sec());
- s->tmr_overflow_time = (d + 0x800000LL) & ~0x7fffffLL;
- }
- s->pmsts &= ~val;
- pm_update_sci(s);
- }
- break;
- case 0x02:
- s->pmen = val;
- pm_update_sci(s);
- break;
- case 0x04:
- {
- int sus_typ;
- s->pmcntrl = val & ~(ACPI_BITMASK_SLEEP_ENABLE);
- if (val & ACPI_BITMASK_SLEEP_ENABLE) {
- /* change suspend type */
- sus_typ = (val >> 10) & 7;
- switch(sus_typ) {
- case 0: /* soft power off */
- qemu_system_shutdown_request();
- break;
- case 1:
- /* ACPI_BITMASK_WAKE_STATUS should be set on resume.
- Pretend that resume was caused by power button */
- s->pmsts |= (ACPI_BITMASK_WAKE_STATUS |
- ACPI_BITMASK_POWER_BUTTON_STATUS);
- qemu_system_reset_request();
-#if defined(TARGET_I386)
- cmos_set_s3_resume();
-#endif
- default:
- break;
- }
- }
- }
- break;
- default:
- break;
- }
-#ifdef DEBUG
- printf("PM writew port=0x%04x val=0x%04x\n", addr, val);
-#endif
-}
-
-static uint32_t pm_ioport_readw(void *opaque, uint32_t addr)
-{
- PIIX4PMState *s = opaque;
- uint32_t val;
-
- addr &= 0x3f;
- switch(addr) {
- case 0x00:
- val = get_pmsts(s);
- break;
- case 0x02:
- val = s->pmen;
- break;
- case 0x04:
- val = s->pmcntrl;
- break;
- default:
- val = 0;
- break;
- }
-#ifdef DEBUG
- printf("PM readw port=0x%04x val=0x%04x\n", addr, val);
-#endif
- return val;
-}
-
-static void pm_ioport_writel(void *opaque, uint32_t addr, uint32_t val)
-{
- // PIIX4PMState *s = opaque;
- addr &= 0x3f;
-#ifdef DEBUG
- printf("PM writel port=0x%04x val=0x%08x\n", addr, val);
-#endif
-}
-
-static uint32_t pm_ioport_readl(void *opaque, uint32_t addr)
-{
- PIIX4PMState *s = opaque;
- uint32_t val;
-
- addr &= 0x3f;
- switch(addr) {
- case 0x08:
- val = get_pmtmr(s);
- break;
- default:
- val = 0;
- break;
- }
-#ifdef DEBUG
- printf("PM readl port=0x%04x val=0x%08x\n", addr, val);
-#endif
- return val;
-}
-
-static void apm_ctrl_changed(uint32_t val, void *arg)
-{
- PIIX4PMState *s = arg;
-
- /* ACPI specs 3.0, 4.7.2.5 */
- if (val == ACPI_ENABLE) {
- s->pmcntrl |= ACPI_BITMASK_SCI_ENABLE;
- } else if (val == ACPI_DISABLE) {
- s->pmcntrl &= ~ACPI_BITMASK_SCI_ENABLE;
- }
-
- if (s->dev.config[0x5b] & (1 << 1)) {
- cpu_interrupt(first_cpu, CPU_INTERRUPT_SMI);
- }
-}
-
-static void acpi_dbg_writel(void *opaque, uint32_t addr, uint32_t val)
-{
-#if defined(DEBUG)
- printf("ACPI: DBG: 0x%08x\n", val);
-#endif
-}
-
-static void pm_io_space_update(PIIX4PMState *s)
-{
- uint32_t pm_io_base;
-
- if (s->dev.config[0x80] & 1) {
- pm_io_base = le32_to_cpu(*(uint32_t *)(s->dev.config + 0x40));
- pm_io_base &= 0xffc0;
-
- /* XXX: need to improve memory and ioport allocation */
-#if defined(DEBUG)
- printf("PM: mapping to 0x%x\n", pm_io_base);
-#endif
- register_ioport_write(pm_io_base, 64, 2, pm_ioport_writew, s);
- register_ioport_read(pm_io_base, 64, 2, pm_ioport_readw, s);
- register_ioport_write(pm_io_base, 64, 4, pm_ioport_writel, s);
- register_ioport_read(pm_io_base, 64, 4, pm_ioport_readl, s);
- }
-}
-
-static void pm_write_config(PCIDevice *d,
- uint32_t address, uint32_t val, int len)
-{
- pci_default_write_config(d, address, val, len);
- if (address == 0x80)
- pm_io_space_update((PIIX4PMState *)d);
-}
-
-static int vmstate_acpi_post_load(void *opaque, int version_id)
-{
- PIIX4PMState *s = opaque;
-
- pm_io_space_update(s);
- return 0;
-}
-
-static const VMStateDescription vmstate_acpi = {
- .name = "piix4_pm",
- .version_id = 1,
- .minimum_version_id = 1,
- .minimum_version_id_old = 1,
- .post_load = vmstate_acpi_post_load,
- .fields = (VMStateField []) {
- VMSTATE_PCI_DEVICE(dev, PIIX4PMState),
- VMSTATE_UINT16(pmsts, PIIX4PMState),
- VMSTATE_UINT16(pmen, PIIX4PMState),
- VMSTATE_UINT16(pmcntrl, PIIX4PMState),
- VMSTATE_STRUCT(apm, PIIX4PMState, 0, vmstate_pc_apm, APMState),
- VMSTATE_TIMER(tmr_timer, PIIX4PMState),
- VMSTATE_INT64(tmr_overflow_time, PIIX4PMState),
- VMSTATE_END_OF_LIST()
- }
-};
-
-static void piix4_reset(void *opaque)
-{
- PIIX4PMState *s = opaque;
- uint8_t *pci_conf = s->dev.config;
-
- pci_conf[0x58] = 0;
- pci_conf[0x59] = 0;
- pci_conf[0x5a] = 0;
- pci_conf[0x5b] = 0;
-
- if (kvm_enabled()) {
- /* Mark SMM as already inited (until KVM supports SMM). */
- pci_conf[0x5B] = 0x02;
- }
-}
-
-static void piix4_powerdown(void *opaque, int irq, int power_failing)
-{
-#if defined(TARGET_I386)
- PIIX4PMState *s = opaque;
-
- if (!s) {
- qemu_system_shutdown_request();
- } else if (s->pmen & ACPI_BITMASK_POWER_BUTTON_ENABLE) {
- s->pmsts |= ACPI_BITMASK_POWER_BUTTON_STATUS;
- pm_update_sci(s);
- }
-#endif
-}
-
-i2c_bus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
- qemu_irq sci_irq)
-{
- PIIX4PMState *s;
- uint8_t *pci_conf;
-
- s = (PIIX4PMState *)pci_register_device(bus,
- "PM", sizeof(PIIX4PMState),
- devfn, NULL, pm_write_config);
- pm_state = s;
- pci_conf = s->dev.config;
- pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_INTEL);
- pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_INTEL_82371AB_3);
- pci_conf[0x06] = 0x80;
- pci_conf[0x07] = 0x02;
- pci_conf[0x08] = 0x03; // revision number
- pci_conf[0x09] = 0x00;
- pci_config_set_class(pci_conf, PCI_CLASS_BRIDGE_OTHER);
- pci_conf[PCI_HEADER_TYPE] = PCI_HEADER_TYPE_NORMAL; // header_type
- pci_conf[0x3d] = 0x01; // interrupt pin 1
-
- pci_conf[0x40] = 0x01; /* PM io base read only bit */
-
- /* APM */
- apm_init(&s->apm, apm_ctrl_changed, s);
-
- register_ioport_write(ACPI_DBG_IO_ADDR, 4, 4, acpi_dbg_writel, s);
-
- if (kvm_enabled()) {
- /* Mark SMM as already inited to prevent SMM from running. KVM does not
- * support SMM mode. */
- pci_conf[0x5B] = 0x02;
- }
-
- /* XXX: which specification is used ? The i82731AB has different
- mappings */
- pci_conf[0x5f] = (parallel_hds[0] != NULL ? 0x80 : 0) | 0x10;
- pci_conf[0x63] = 0x60;
- pci_conf[0x67] = (serial_hds[0] != NULL ? 0x08 : 0) |
- (serial_hds[1] != NULL ? 0x90 : 0);
-
- pci_conf[0x90] = smb_io_base | 1;
- pci_conf[0x91] = smb_io_base >> 8;
- pci_conf[0xd2] = 0x09;
- register_ioport_write(smb_io_base, 64, 1, smb_ioport_writeb, &s->smb);
- register_ioport_read(smb_io_base, 64, 1, smb_ioport_readb, &s->smb);
-
- s->tmr_timer = qemu_new_timer(vm_clock, pm_tmr_timer, s);
-
- qemu_system_powerdown = *qemu_allocate_irqs(piix4_powerdown, s, 1);
-
- vmstate_register(0, &vmstate_acpi, s);
-
- pc_smbus_init(NULL, &s->smb);
- s->irq = sci_irq;
- qemu_register_reset(piix4_reset, s);
-
- return s->smb.smbus;
-}
-
-#define GPE_BASE 0xafe0
-#define PCI_BASE 0xae00
-#define PCI_EJ_BASE 0xae08
-
-struct gpe_regs {
- uint16_t sts; /* status */
- uint16_t en; /* enabled */
-};
-
-struct pci_status {
- uint32_t up;
- uint32_t down;
-};
-
-static struct gpe_regs gpe;
-static struct pci_status pci0_status;
-
-static uint32_t gpe_read_val(uint16_t val, uint32_t addr)
-{
- if (addr & 1)
- return (val >> 8) & 0xff;
- return val & 0xff;
-}
-
-static uint32_t gpe_readb(void *opaque, uint32_t addr)
-{
- uint32_t val = 0;
- struct gpe_regs *g = opaque;
- switch (addr) {
- case GPE_BASE:
- case GPE_BASE + 1:
- val = gpe_read_val(g->sts, addr);
- break;
- case GPE_BASE + 2:
- case GPE_BASE + 3:
- val = gpe_read_val(g->en, addr);
- break;
- default:
- break;
- }
-
-#if defined(DEBUG)
- printf("gpe read %x == %x\n", addr, val);
-#endif
- return val;
-}
-
-static void gpe_write_val(uint16_t *cur, int addr, uint32_t val)
-{
- if (addr & 1)
- *cur = (*cur & 0xff) | (val << 8);
- else
- *cur = (*cur & 0xff00) | (val & 0xff);
-}
-
-static void gpe_reset_val(uint16_t *cur, int addr, uint32_t val)
-{
- uint16_t x1, x0 = val & 0xff;
- int shift = (addr & 1) ? 8 : 0;
-
- x1 = (*cur >> shift) & 0xff;
-
- x1 = x1 & ~x0;
-
- *cur = (*cur & (0xff << (8 - shift))) | (x1 << shift);
-}
-
-static void gpe_writeb(void *opaque, uint32_t addr, uint32_t val)
-{
- struct gpe_regs *g = opaque;
- switch (addr) {
- case GPE_BASE:
- case GPE_BASE + 1:
- gpe_reset_val(&g->sts, addr, val);
- break;
- case GPE_BASE + 2:
- case GPE_BASE + 3:
- gpe_write_val(&g->en, addr, val);
- break;
- default:
- break;
- }
-
-#if defined(DEBUG)
- printf("gpe write %x <== %d\n", addr, val);
-#endif
-}
-
-static uint32_t pcihotplug_read(void *opaque, uint32_t addr)
-{
- uint32_t val = 0;
- struct pci_status *g = opaque;
- switch (addr) {
- case PCI_BASE:
- val = g->up;
- break;
- case PCI_BASE + 4:
- val = g->down;
- break;
- default:
- break;
- }
-
-#if defined(DEBUG)
- printf("pcihotplug read %x == %x\n", addr, val);
-#endif
- return val;
-}
-
-static void pcihotplug_write(void *opaque, uint32_t addr, uint32_t val)
-{
- struct pci_status *g = opaque;
- switch (addr) {
- case PCI_BASE:
- g->up = val;
- break;
- case PCI_BASE + 4:
- g->down = val;
- break;
- }
-
-#if defined(DEBUG)
- printf("pcihotplug write %x <== %d\n", addr, val);
-#endif
-}
-
-static uint32_t pciej_read(void *opaque, uint32_t addr)
-{
-#if defined(DEBUG)
- printf("pciej read %x\n", addr);
-#endif
- return 0;
-}
-
-static void pciej_write(void *opaque, uint32_t addr, uint32_t val)
-{
- BusState *bus = opaque;
- DeviceState *qdev, *next;
- PCIDevice *dev;
- int slot = ffs(val) - 1;
-
- QLIST_FOREACH_SAFE(qdev, &bus->children, sibling, next) {
- dev = DO_UPCAST(PCIDevice, qdev, qdev);
- if (PCI_SLOT(dev->devfn) == slot) {
- qdev_free(qdev);
- }
- }
-
-
-#if defined(DEBUG)
- printf("pciej write %x <== %d\n", addr, val);
-#endif
-}
-
-static int piix4_device_hotplug(PCIDevice *dev, int state);
-
-void piix4_acpi_system_hot_add_init(PCIBus *bus)
-{
- register_ioport_write(GPE_BASE, 4, 1, gpe_writeb, &gpe);
- register_ioport_read(GPE_BASE, 4, 1, gpe_readb, &gpe);
-
- register_ioport_write(PCI_BASE, 8, 4, pcihotplug_write, &pci0_status);
- register_ioport_read(PCI_BASE, 8, 4, pcihotplug_read, &pci0_status);
-
- register_ioport_write(PCI_EJ_BASE, 4, 4, pciej_write, bus);
- register_ioport_read(PCI_EJ_BASE, 4, 4, pciej_read, bus);
-
- pci_bus_hotplug(bus, piix4_device_hotplug);
-}
-
-static void enable_device(struct pci_status *p, struct gpe_regs *g, int slot)
-{
- g->sts |= 2;
- p->up |= (1 << slot);
-}
-
-static void disable_device(struct pci_status *p, struct gpe_regs *g, int slot)
-{
- g->sts |= 2;
- p->down |= (1 << slot);
-}
-
-static int piix4_device_hotplug(PCIDevice *dev, int state)
-{
- int slot = PCI_SLOT(dev->devfn);
-
- pci0_status.up = 0;
- pci0_status.down = 0;
- if (state)
- enable_device(&pci0_status, &gpe, slot);
- else
- disable_device(&pci0_status, &gpe, slot);
- if (gpe.en & 2) {
- qemu_set_irq(pm_state->irq, 1);
- qemu_set_irq(pm_state->irq, 0);
- }
- return 0;
-}
-
struct acpi_table_header
{
char signature [4]; /* ACPI signature (4 ASCII characters) */
diff --git a/hw/acpi.c b/hw/acpi_piix4.c
similarity index 76%
copy from hw/acpi.c
copy to hw/acpi_piix4.c
index b83f8e6..71b1156 100644
--- a/hw/acpi.c
+++ b/hw/acpi_piix4.c
@@ -55,7 +55,8 @@ static PIIX4PMState *pm_state;
static uint32_t get_pmtmr(PIIX4PMState *s)
{
uint32_t d;
- d = muldiv64(qemu_get_clock(vm_clock), PM_TIMER_FREQUENCY, get_ticks_per_sec());
+ d = muldiv64(qemu_get_clock(vm_clock), PM_TIMER_FREQUENCY,
+ get_ticks_per_sec());
return d & 0xffffff;
}
@@ -577,172 +578,3 @@ static int piix4_device_hotplug(PCIDevice *dev, int state)
}
return 0;
}
-
-struct acpi_table_header
-{
- char signature [4]; /* ACPI signature (4 ASCII characters) */
- uint32_t length; /* Length of table, in bytes, including header */
- uint8_t revision; /* ACPI Specification minor version # */
- uint8_t checksum; /* To make sum of entire table == 0 */
- char oem_id [6]; /* OEM identification */
- char oem_table_id [8]; /* OEM table identification */
- uint32_t oem_revision; /* OEM revision number */
- char asl_compiler_id [4]; /* ASL compiler vendor ID */
- uint32_t asl_compiler_revision; /* ASL compiler revision number */
-} __attribute__((packed));
-
-char *acpi_tables;
-size_t acpi_tables_len;
-
-static int acpi_checksum(const uint8_t *data, int len)
-{
- int sum, i;
- sum = 0;
- for(i = 0; i < len; i++)
- sum += data[i];
- return (-sum) & 0xff;
-}
-
-int acpi_table_add(const char *t)
-{
- static const char *dfl_id = "QEMUQEMU";
- char buf[1024], *p, *f;
- struct acpi_table_header acpi_hdr;
- unsigned long val;
- size_t off;
-
- memset(&acpi_hdr, 0, sizeof(acpi_hdr));
-
- if (get_param_value(buf, sizeof(buf), "sig", t)) {
- strncpy(acpi_hdr.signature, buf, 4);
- } else {
- strncpy(acpi_hdr.signature, dfl_id, 4);
- }
- if (get_param_value(buf, sizeof(buf), "rev", t)) {
- val = strtoul(buf, &p, 10);
- if (val > 255 || *p != '\0')
- goto out;
- } else {
- val = 1;
- }
- acpi_hdr.revision = (int8_t)val;
-
- if (get_param_value(buf, sizeof(buf), "oem_id", t)) {
- strncpy(acpi_hdr.oem_id, buf, 6);
- } else {
- strncpy(acpi_hdr.oem_id, dfl_id, 6);
- }
-
- if (get_param_value(buf, sizeof(buf), "oem_table_id", t)) {
- strncpy(acpi_hdr.oem_table_id, buf, 8);
- } else {
- strncpy(acpi_hdr.oem_table_id, dfl_id, 8);
- }
-
- if (get_param_value(buf, sizeof(buf), "oem_rev", t)) {
- val = strtol(buf, &p, 10);
- if(*p != '\0')
- goto out;
- } else {
- val = 1;
- }
- acpi_hdr.oem_revision = cpu_to_le32(val);
-
- if (get_param_value(buf, sizeof(buf), "asl_compiler_id", t)) {
- strncpy(acpi_hdr.asl_compiler_id, buf, 4);
- } else {
- strncpy(acpi_hdr.asl_compiler_id, dfl_id, 4);
- }
-
- if (get_param_value(buf, sizeof(buf), "asl_compiler_rev", t)) {
- val = strtol(buf, &p, 10);
- if(*p != '\0')
- goto out;
- } else {
- val = 1;
- }
- acpi_hdr.asl_compiler_revision = cpu_to_le32(val);
-
- if (!get_param_value(buf, sizeof(buf), "data", t)) {
- buf[0] = '\0';
- }
-
- acpi_hdr.length = sizeof(acpi_hdr);
-
- f = buf;
- while (buf[0]) {
- struct stat s;
- char *n = strchr(f, ':');
- if (n)
- *n = '\0';
- if(stat(f, &s) < 0) {
- fprintf(stderr, "Can't stat file '%s': %s\n", f, strerror(errno));
- goto out;
- }
- acpi_hdr.length += s.st_size;
- if (!n)
- break;
- *n = ':';
- f = n + 1;
- }
-
- if (!acpi_tables) {
- acpi_tables_len = sizeof(uint16_t);
- acpi_tables = qemu_mallocz(acpi_tables_len);
- }
- p = acpi_tables + acpi_tables_len;
- acpi_tables_len += sizeof(uint16_t) + acpi_hdr.length;
- acpi_tables = qemu_realloc(acpi_tables, acpi_tables_len);
-
- acpi_hdr.length = cpu_to_le32(acpi_hdr.length);
- *(uint16_t*)p = acpi_hdr.length;
- p += sizeof(uint16_t);
- memcpy(p, &acpi_hdr, sizeof(acpi_hdr));
- off = sizeof(acpi_hdr);
-
- f = buf;
- while (buf[0]) {
- struct stat s;
- int fd;
- char *n = strchr(f, ':');
- if (n)
- *n = '\0';
- fd = open(f, O_RDONLY);
-
- if(fd < 0)
- goto out;
- if(fstat(fd, &s) < 0) {
- close(fd);
- goto out;
- }
-
- do {
- int r;
- r = read(fd, p + off, s.st_size);
- if (r > 0) {
- off += r;
- s.st_size -= r;
- } else if ((r < 0 && errno != EINTR) || r == 0) {
- close(fd);
- goto out;
- }
- } while(s.st_size);
-
- close(fd);
- if (!n)
- break;
- f = n + 1;
- }
-
- ((struct acpi_table_header*)p)->checksum = acpi_checksum((uint8_t*)p, off);
- /* increase number of tables */
- (*(uint16_t*)acpi_tables) =
- cpu_to_le32(le32_to_cpu(*(uint16_t*)acpi_tables) + 1);
- return 0;
-out:
- if (acpi_tables) {
- qemu_free(acpi_tables);
- acpi_tables = NULL;
- }
- return -1;
-}
--
1.6.5.4
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [Qemu-devel] [PATCH V11 05/27] acpi_piix4: remove unused variable in get_pmsts().
2010-01-05 6:27 [Qemu-devel] [PATCH V11 00/27] split out piix specific part from pc emulator and some clean ups Isaku Yamahata
` (3 preceding siblings ...)
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 04/27] acpi: split acpi.c into the common part and the piix4 part Isaku Yamahata
@ 2010-01-05 6:27 ` Isaku Yamahata
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 06/27] pc: initialize ioapic before use Isaku Yamahata
` (22 subsequent siblings)
27 siblings, 0 replies; 32+ messages in thread
From: Isaku Yamahata @ 2010-01-05 6:27 UTC (permalink / raw)
To: qemu-devel, kraxel; +Cc: yamahata
remove unused variable in get_pmsts().
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
hw/acpi_piix4.c | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/hw/acpi_piix4.c b/hw/acpi_piix4.c
index 71b1156..802cd92 100644
--- a/hw/acpi_piix4.c
+++ b/hw/acpi_piix4.c
@@ -63,8 +63,6 @@ static uint32_t get_pmtmr(PIIX4PMState *s)
static int get_pmsts(PIIX4PMState *s)
{
int64_t d;
- int pmsts;
- pmsts = s->pmsts;
d = muldiv64(qemu_get_clock(vm_clock), PM_TIMER_FREQUENCY,
get_ticks_per_sec());
if (d >= s->tmr_overflow_time)
--
1.6.5.4
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [Qemu-devel] [PATCH V11 06/27] pc: initialize ioapic before use.
2010-01-05 6:27 [Qemu-devel] [PATCH V11 00/27] split out piix specific part from pc emulator and some clean ups Isaku Yamahata
` (4 preceding siblings ...)
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 05/27] acpi_piix4: remove unused variable in get_pmsts() Isaku Yamahata
@ 2010-01-05 6:27 ` Isaku Yamahata
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 07/27] pc, i440fx: Make smm enable/disable function i440fx independent Isaku Yamahata
` (21 subsequent siblings)
27 siblings, 0 replies; 32+ messages in thread
From: Isaku Yamahata @ 2010-01-05 6:27 UTC (permalink / raw)
To: qemu-devel, kraxel; +Cc: yamahata
The changeset of 2c8d9340203c7f19265fd4cb2341f568217a3af6
prevents isa_irq_handler() from NULL refering of IsaIrqState::ioapic.
However it would be better to initialize the member before reference.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
hw/pc.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/hw/pc.c b/hw/pc.c
index 83f8dd0..fbacc1e 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -1112,6 +1112,9 @@ static void pc_init1(ram_addr_t ram_size,
i8259 = i8259_init(cpu_irq[0]);
isa_irq_state = qemu_mallocz(sizeof(*isa_irq_state));
isa_irq_state->i8259 = i8259;
+ if (pci_enabled) {
+ isa_irq_state->ioapic = ioapic_init();
+ }
isa_irq = qemu_allocate_irqs(isa_irq_handler, isa_irq_state, 24);
if (pci_enabled) {
@@ -1155,9 +1158,6 @@ static void pc_init1(ram_addr_t ram_size,
register_ioport_read(0x92, 1, 1, ioport92_read, NULL);
register_ioport_write(0x92, 1, 1, ioport92_write, NULL);
- if (pci_enabled) {
- isa_irq_state->ioapic = ioapic_init();
- }
pit = pit_init(0x40, isa_reserve_irq(0));
pcspk_init(pit);
if (!no_hpet) {
--
1.6.5.4
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [Qemu-devel] [PATCH V11 07/27] pc, i440fx: Make smm enable/disable function i440fx independent.
2010-01-05 6:27 [Qemu-devel] [PATCH V11 00/27] split out piix specific part from pc emulator and some clean ups Isaku Yamahata
` (5 preceding siblings ...)
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 06/27] pc: initialize ioapic before use Isaku Yamahata
@ 2010-01-05 6:27 ` Isaku Yamahata
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 08/27] pc: make an unnecessary global variable, pit, local Isaku Yamahata
` (20 subsequent siblings)
27 siblings, 0 replies; 32+ messages in thread
From: Isaku Yamahata @ 2010-01-05 6:27 UTC (permalink / raw)
To: qemu-devel, kraxel; +Cc: yamahata
make cpu_smm_update() generic to be independent on i440fx by
registering a callback.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
hw/pc.c | 18 +++++++++++++++---
hw/pc.h | 8 +++++++-
hw/piix_pci.c | 5 ++++-
3 files changed, 26 insertions(+), 5 deletions(-)
diff --git a/hw/pc.c b/hw/pc.c
index fbacc1e..cdd9de6 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -67,7 +67,6 @@
static fdctrl_t *floppy_controller;
static RTCState *rtc_state;
static PITState *pit;
-static PCII440FXState *i440fx_state;
typedef struct isa_irq_state {
qemu_irq *i8259;
@@ -109,10 +108,22 @@ uint64_t cpu_get_tsc(CPUX86State *env)
}
/* SMM support */
+
+static cpu_set_smm_t smm_set;
+static void *smm_arg;
+
+void cpu_smm_register(cpu_set_smm_t callback, void *arg)
+{
+ assert(smm_set == NULL);
+ assert(smm_arg == NULL);
+ smm_set = callback;
+ smm_arg = arg;
+}
+
void cpu_smm_update(CPUState *env)
{
- if (i440fx_state && env == first_cpu)
- i440fx_set_smm(i440fx_state, (env->hflags >> HF_SMM_SHIFT) & 1);
+ if (smm_set && smm_arg && env == first_cpu)
+ smm_set(!!(env->hflags & HF_SMM_MASK), smm_arg);
}
@@ -996,6 +1007,7 @@ static void pc_init1(ram_addr_t ram_size,
int bios_size, isa_bios_size;
PCIBus *pci_bus;
ISADevice *isa_dev;
+ PCII440FXState *i440fx_state;
int piix3_devfn = -1;
CPUState *env;
qemu_irq *cpu_irq;
diff --git a/hw/pc.h b/hw/pc.h
index 03ffc91..cbecc07 100644
--- a/hw/pc.h
+++ b/hw/pc.h
@@ -94,6 +94,13 @@ extern int fd_bootchk;
void ioport_set_a20(int enable);
int ioport_get_a20(void);
+typedef void (*cpu_set_smm_t)(int smm, void *arg);
+#if defined(TARGET_I386)
+void cpu_smm_register(cpu_set_smm_t callback, void *arg);
+#else
+static inline void cpu_smm_register(cpu_set_smm_t callback, void *arg) { };
+#endif
+
/* acpi.c */
extern int acpi_enabled;
extern char *acpi_tables;
@@ -120,7 +127,6 @@ struct PCII440FXState;
typedef struct PCII440FXState PCII440FXState;
PCIBus *i440fx_init(PCII440FXState **pi440fx_state, int *piix_devfn, qemu_irq *pic);
-void i440fx_set_smm(PCII440FXState *d, int val);
void i440fx_init_memory_mappings(PCII440FXState *d);
/* piix4.c */
diff --git a/hw/piix_pci.c b/hw/piix_pci.c
index 1b67475..ff689a3 100644
--- a/hw/piix_pci.c
+++ b/hw/piix_pci.c
@@ -104,8 +104,10 @@ static void i440fx_update_memory_mappings(PCII440FXState *d)
}
}
-void i440fx_set_smm(PCII440FXState *d, int val)
+static void i440fx_set_smm(int val, void *arg)
{
+ PCII440FXState *d = arg;
+
val = (val != 0);
if (d->smm_enabled != val) {
d->smm_enabled = val;
@@ -198,6 +200,7 @@ static int i440fx_initfn(PCIDevice *dev)
d->dev.config[0x72] = 0x02; /* SMRAM */
+ cpu_smm_register(&i440fx_set_smm, d);
return 0;
}
--
1.6.5.4
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [Qemu-devel] [PATCH V11 08/27] pc: make an unnecessary global variable, pit, local.
2010-01-05 6:27 [Qemu-devel] [PATCH V11 00/27] split out piix specific part from pc emulator and some clean ups Isaku Yamahata
` (6 preceding siblings ...)
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 07/27] pc, i440fx: Make smm enable/disable function i440fx independent Isaku Yamahata
@ 2010-01-05 6:27 ` Isaku Yamahata
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 09/27] pc: remove a global variable, floppy_controller Isaku Yamahata
` (19 subsequent siblings)
27 siblings, 0 replies; 32+ messages in thread
From: Isaku Yamahata @ 2010-01-05 6:27 UTC (permalink / raw)
To: qemu-devel, kraxel; +Cc: yamahata
remove unnecessary global static variables, pit.
Make it local.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
hw/pc.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/hw/pc.c b/hw/pc.c
index cdd9de6..0dee9d7 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -66,7 +66,6 @@
static fdctrl_t *floppy_controller;
static RTCState *rtc_state;
-static PITState *pit;
typedef struct isa_irq_state {
qemu_irq *i8259;
@@ -1017,6 +1016,7 @@ static void pc_init1(ram_addr_t ram_size,
DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
DriveInfo *fd[MAX_FD];
void *fw_cfg;
+ PITState *pit;
if (ram_size >= 0xe0000000 ) {
above_4g_mem_size = ram_size - 0xe0000000;
--
1.6.5.4
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [Qemu-devel] [PATCH V11 09/27] pc: remove a global variable, floppy_controller.
2010-01-05 6:27 [Qemu-devel] [PATCH V11 00/27] split out piix specific part from pc emulator and some clean ups Isaku Yamahata
` (7 preceding siblings ...)
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 08/27] pc: make an unnecessary global variable, pit, local Isaku Yamahata
@ 2010-01-05 6:27 ` Isaku Yamahata
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 10/27] pc: remove global variable rtc_state by using qemu_irq Isaku Yamahata
` (18 subsequent siblings)
27 siblings, 0 replies; 32+ messages in thread
From: Isaku Yamahata @ 2010-01-05 6:27 UTC (permalink / raw)
To: qemu-devel, kraxel; +Cc: yamahata
Remove a global variable, floppy_controller.
Since it is unnecessarily global, make it local and pass it as
a function argument.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
hw/pc.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/hw/pc.c b/hw/pc.c
index 0dee9d7..f5eb026 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -64,7 +64,6 @@
#define MAX_IDE_BUS 2
-static fdctrl_t *floppy_controller;
static RTCState *rtc_state;
typedef struct isa_irq_state {
@@ -256,7 +255,8 @@ static int pc_boot_set(void *opaque, const char *boot_device)
/* 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, DriveInfo **hd_table)
+ const char *boot_device, DriveInfo **hd_table,
+ fdctrl_t *floppy_controller)
{
RTCState *s = rtc_state;
int nbds, bds[3] = { 0, };
@@ -1016,6 +1016,7 @@ static void pc_init1(ram_addr_t ram_size,
DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
DriveInfo *fd[MAX_FD];
void *fw_cfg;
+ fdctrl_t *floppy_controller;
PITState *pit;
if (ram_size >= 0xe0000000 ) {
@@ -1226,7 +1227,8 @@ static void pc_init1(ram_addr_t ram_size,
}
floppy_controller = fdctrl_init_isa(fd);
- cmos_init(below_4g_mem_size, above_4g_mem_size, boot_device, hd);
+ cmos_init(below_4g_mem_size, above_4g_mem_size, boot_device, hd,
+ floppy_controller);
if (pci_enabled && usb_enabled) {
usb_uhci_piix3_init(pci_bus, piix3_devfn + 2);
--
1.6.5.4
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [Qemu-devel] [PATCH V11 10/27] pc: remove global variable rtc_state by using qemu_irq.
2010-01-05 6:27 [Qemu-devel] [PATCH V11 00/27] split out piix specific part from pc emulator and some clean ups Isaku Yamahata
` (8 preceding siblings ...)
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 09/27] pc: remove a global variable, floppy_controller Isaku Yamahata
@ 2010-01-05 6:27 ` Isaku Yamahata
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 11/27] pc: introduce a function to allocate cpu irq Isaku Yamahata
` (17 subsequent siblings)
27 siblings, 0 replies; 32+ messages in thread
From: Isaku Yamahata @ 2010-01-05 6:27 UTC (permalink / raw)
To: qemu-devel, kraxel; +Cc: yamahata, Paolo Bonzini
Remove the reference to the global variable, rtc_state, by passing
function argument to cmos_init_hd(), cmos_init().
And following d9c3231019a0fbacbe15dcb26a0e3708b726af77 which uses qemu_irq
for powerdown to eliminate nasty #ifdef (TARGET_xxx),
this patch removes #ifdef(TARGET_I386) and global variable rtc_state.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Cc: Paolo Bonzini <bonzini@gnu.org>
---
hw/acpi_piix4.c | 8 ++++----
hw/mips_malta.c | 3 ++-
hw/pc.c | 27 ++++++++++++++-------------
hw/pc.h | 4 ++--
4 files changed, 22 insertions(+), 20 deletions(-)
diff --git a/hw/acpi_piix4.c b/hw/acpi_piix4.c
index 802cd92..c24e358 100644
--- a/hw/acpi_piix4.c
+++ b/hw/acpi_piix4.c
@@ -45,6 +45,7 @@ typedef struct PIIX4PMState {
PCSMBus smb;
qemu_irq irq;
+ qemu_irq cmos_s3_resume;
} PIIX4PMState;
#define ACPI_ENABLE 0xf1
@@ -140,9 +141,7 @@ static void pm_ioport_writew(void *opaque, uint32_t addr, uint32_t val)
s->pmsts |= (ACPI_BITMASK_WAKE_STATUS |
ACPI_BITMASK_POWER_BUTTON_STATUS);
qemu_system_reset_request();
-#if defined(TARGET_I386)
- cmos_set_s3_resume();
-#endif
+ qemu_irq_raise(s->cmos_s3_resume);
default:
break;
}
@@ -319,7 +318,7 @@ static void piix4_powerdown(void *opaque, int irq, int power_failing)
}
i2c_bus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
- qemu_irq sci_irq)
+ qemu_irq sci_irq, qemu_irq cmos_s3_resume)
{
PIIX4PMState *s;
uint8_t *pci_conf;
@@ -373,6 +372,7 @@ i2c_bus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
pc_smbus_init(NULL, &s->smb);
s->irq = sci_irq;
+ s->cmos_s3_resume = cmos_s3_resume;
qemu_register_reset(piix4_reset, s);
return s->smb.smbus;
diff --git a/hw/mips_malta.c b/hw/mips_malta.c
index 571d8ce..a507bc7 100644
--- a/hw/mips_malta.c
+++ b/hw/mips_malta.c
@@ -927,7 +927,8 @@ void mips_malta_init (ram_addr_t ram_size,
isa_bus_irqs(i8259);
pci_piix4_ide_init(pci_bus, hd, piix4_devfn + 1);
usb_uhci_piix4_init(pci_bus, piix4_devfn + 2);
- smbus = piix4_pm_init(pci_bus, piix4_devfn + 3, 0x1100, isa_reserve_irq(9));
+ smbus = piix4_pm_init(pci_bus, piix4_devfn + 3, 0x1100,
+ isa_reserve_irq(9), NULL);
eeprom_buf = qemu_mallocz(8 * 256); /* XXX: make this persistent */
for (i = 0; i < 8; i++) {
/* TODO: Populate SPD eeprom data. */
diff --git a/hw/pc.c b/hw/pc.c
index f5eb026..3ad9bbb 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -64,8 +64,6 @@
#define MAX_IDE_BUS 2
-static RTCState *rtc_state;
-
typedef struct isa_irq_state {
qemu_irq *i8259;
qemu_irq *ioapic;
@@ -191,9 +189,9 @@ static int cmos_get_fd_drive_type(int fd0)
return val;
}
-static void cmos_init_hd(int type_ofs, int info_ofs, BlockDriverState *hd)
+static void cmos_init_hd(int type_ofs, int info_ofs, BlockDriverState *hd,
+ RTCState *s)
{
- RTCState *s = rtc_state;
int cylinders, heads, sectors;
bdrv_get_geometry_hint(hd, &cylinders, &heads, §ors);
rtc_set_memory(s, type_ofs, 47);
@@ -256,9 +254,8 @@ static int pc_boot_set(void *opaque, const char *boot_device)
/* 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, DriveInfo **hd_table,
- fdctrl_t *floppy_controller)
+ fdctrl_t *floppy_controller, RTCState *s)
{
- RTCState *s = rtc_state;
int nbds, bds[3] = { 0, };
int val;
int fd0, fd1, nb;
@@ -347,9 +344,9 @@ static void cmos_init(ram_addr_t ram_size, ram_addr_t above_4g_mem_size,
rtc_set_memory(s, 0x12, (hd_table[0] ? 0xf0 : 0) | (hd_table[1] ? 0x0f : 0));
if (hd_table[0])
- cmos_init_hd(0x19, 0x1b, hd_table[0]->bdrv);
+ cmos_init_hd(0x19, 0x1b, hd_table[0]->bdrv, s);
if (hd_table[1])
- cmos_init_hd(0x1a, 0x24, hd_table[1]->bdrv);
+ cmos_init_hd(0x1a, 0x24, hd_table[1]->bdrv, s);
val = 0;
for (i = 0; i < 4; i++) {
@@ -1017,6 +1014,7 @@ static void pc_init1(ram_addr_t ram_size,
DriveInfo *fd[MAX_FD];
void *fw_cfg;
fdctrl_t *floppy_controller;
+ RTCState *rtc_state;
PITState *pit;
if (ram_size >= 0xe0000000 ) {
@@ -1228,7 +1226,7 @@ static void pc_init1(ram_addr_t ram_size,
floppy_controller = fdctrl_init_isa(fd);
cmos_init(below_4g_mem_size, above_4g_mem_size, boot_device, hd,
- floppy_controller);
+ floppy_controller, rtc_state);
if (pci_enabled && usb_enabled) {
usb_uhci_piix3_init(pci_bus, piix3_devfn + 2);
@@ -1238,9 +1236,12 @@ static void pc_init1(ram_addr_t ram_size,
uint8_t *eeprom_buf = qemu_mallocz(8 * 256); /* XXX: make this persistent */
i2c_bus *smbus;
+ qemu_irq cmos_s3_resume =
+ *qemu_allocate_irqs(cmos_set_s3_resume_fn, rtc_state, 1);
+
/* TODO: Populate SPD eeprom data. */
smbus = piix4_pm_init(pci_bus, piix3_devfn + 3, 0xb100,
- isa_reserve_irq(9));
+ isa_reserve_irq(9), cmos_s3_resume);
for (i = 0; i < 8; i++) {
DeviceState *eeprom;
eeprom = qdev_create((BusState *)smbus, "smbus-eeprom");
@@ -1305,10 +1306,10 @@ static void pc_init_isa(ram_addr_t ram_size,
/* set CMOS shutdown status register (index 0xF) as S3_resume(0xFE)
BIOS will read it and start S3 resume at POST Entry */
-void cmos_set_s3_resume(void)
+void cmos_set_s3_resume_fn(void *opaque, int n, int level)
{
- if (rtc_state)
- rtc_set_memory(rtc_state, 0xF, 0xFE);
+ RTCState *rtc_state = opaque;
+ rtc_set_memory(rtc_state, 0xF, 0xFE);
}
static QEMUMachine pc_machine = {
diff --git a/hw/pc.h b/hw/pc.h
index cbecc07..4ad20c1 100644
--- a/hw/pc.h
+++ b/hw/pc.h
@@ -86,7 +86,7 @@ typedef struct RTCState RTCState;
RTCState *rtc_init(int base_year);
void rtc_set_memory(RTCState *s, int addr, int val);
void rtc_set_date(RTCState *s, const struct tm *tm);
-void cmos_set_s3_resume(void);
+void cmos_set_s3_resume_fn(void *opaque, int n, int level);
/* pc.c */
extern int fd_bootchk;
@@ -111,7 +111,7 @@ int acpi_table_add(const char *table_desc);
/* acpi_piix.c */
i2c_bus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
- qemu_irq sci_irq);
+ qemu_irq sci_irq, qemu_irq cmos_set_s3_resume);
void piix4_smbus_register_device(SMBusDevice *dev, uint8_t addr);
void piix4_acpi_system_hot_add_init(PCIBus *bus);
--
1.6.5.4
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [Qemu-devel] [PATCH V11 11/27] pc: introduce a function to allocate cpu irq.
2010-01-05 6:27 [Qemu-devel] [PATCH V11 00/27] split out piix specific part from pc emulator and some clean ups Isaku Yamahata
` (9 preceding siblings ...)
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 10/27] pc: remove global variable rtc_state by using qemu_irq Isaku Yamahata
@ 2010-01-05 6:27 ` Isaku Yamahata
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 12/27] pc: make pc_init1() not refer ferr_irq directly Isaku Yamahata
` (16 subsequent siblings)
27 siblings, 0 replies; 32+ messages in thread
From: Isaku Yamahata @ 2010-01-05 6:27 UTC (permalink / raw)
To: qemu-devel, kraxel; +Cc: yamahata
Introduce a function, pc_allocate_cpu_irq(), to allocate cpu irq
in order to make pic_irq_request() piix independent.
Later piix code will be split out to another file keeping pic_irq_request()
static.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
hw/pc.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/hw/pc.c b/hw/pc.c
index 3ad9bbb..fc603bc 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -987,6 +987,11 @@ static CPUState *pc_new_cpu(const char *cpu_model)
return env;
}
+static qemu_irq *pc_allocate_cpu_irq(void)
+{
+ return qemu_allocate_irqs(pic_irq_request, NULL, 1);
+}
+
/* PC hardware initialisation */
static void pc_init1(ram_addr_t ram_size,
const char *boot_device,
@@ -1119,7 +1124,7 @@ static void pc_init1(ram_addr_t ram_size,
rom_add_option(option_rom[i]);
}
- cpu_irq = qemu_allocate_irqs(pic_irq_request, NULL, 1);
+ cpu_irq = pc_allocate_cpu_irq();
i8259 = i8259_init(cpu_irq[0]);
isa_irq_state = qemu_mallocz(sizeof(*isa_irq_state));
isa_irq_state->i8259 = i8259;
--
1.6.5.4
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [Qemu-devel] [PATCH V11 12/27] pc: make pc_init1() not refer ferr_irq directly.
2010-01-05 6:27 [Qemu-devel] [PATCH V11 00/27] split out piix specific part from pc emulator and some clean ups Isaku Yamahata
` (10 preceding siblings ...)
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 11/27] pc: introduce a function to allocate cpu irq Isaku Yamahata
@ 2010-01-05 6:27 ` Isaku Yamahata
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 13/27] pc: split out cpu initialization from pc_init1() into pc_cpus_init() Isaku Yamahata
` (15 subsequent siblings)
27 siblings, 0 replies; 32+ messages in thread
From: Isaku Yamahata @ 2010-01-05 6:27 UTC (permalink / raw)
To: qemu-devel, kraxel; +Cc: yamahata
By introducing a registering function, make pc_init1() not refer to
ferr_irq directly in order to make ferr_irq piix independent.
Later pc_init1() will be split out into another file keeping ferr_irq
static.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
hw/pc.c | 8 +++++++-
hw/pc.h | 2 ++
2 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/hw/pc.c b/hw/pc.c
index fc603bc..1a13b0f 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -86,6 +86,12 @@ static void ioport80_write(void *opaque, uint32_t addr, uint32_t data)
/* MSDOS compatibility mode FPU exception support */
static qemu_irq ferr_irq;
+
+void pc_register_ferr_irq(qemu_irq irq)
+{
+ ferr_irq = irq;
+}
+
/* XXX: add IGNNE support */
void cpu_set_ferr(CPUX86State *s)
{
@@ -1141,7 +1147,7 @@ static void pc_init1(ram_addr_t ram_size,
}
isa_bus_irqs(isa_irq);
- ferr_irq = isa_reserve_irq(13);
+ pc_register_ferr_irq(isa_reserve_irq(13));
/* init basic PC hardware */
register_ioport_write(0x80, 1, 1, ioport80_write, NULL);
diff --git a/hw/pc.h b/hw/pc.h
index 4ad20c1..6791b0b 100644
--- a/hw/pc.h
+++ b/hw/pc.h
@@ -91,6 +91,8 @@ void cmos_set_s3_resume_fn(void *opaque, int n, int level);
/* pc.c */
extern int fd_bootchk;
+void pc_register_ferr_irq(qemu_irq irq);
+
void ioport_set_a20(int enable);
int ioport_get_a20(void);
--
1.6.5.4
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [Qemu-devel] [PATCH V11 13/27] pc: split out cpu initialization from pc_init1() into pc_cpus_init().
2010-01-05 6:27 [Qemu-devel] [PATCH V11 00/27] split out piix specific part from pc emulator and some clean ups Isaku Yamahata
` (11 preceding siblings ...)
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 12/27] pc: make pc_init1() not refer ferr_irq directly Isaku Yamahata
@ 2010-01-05 6:27 ` Isaku Yamahata
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 14/27] pc: split out memory allocation from pc_init1() into pc_memory_init() Isaku Yamahata
` (14 subsequent siblings)
27 siblings, 0 replies; 32+ messages in thread
From: Isaku Yamahata @ 2010-01-05 6:27 UTC (permalink / raw)
To: qemu-devel, kraxel; +Cc: yamahata
split out cpu initialization which is piix independent from pc_init1()
into pc_cpus_init(). Later it will be used.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
hw/pc.c | 32 +++++++++++++++++++-------------
1 files changed, 19 insertions(+), 13 deletions(-)
diff --git a/hw/pc.c b/hw/pc.c
index 1a13b0f..90cf0f4 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -993,6 +993,24 @@ static CPUState *pc_new_cpu(const char *cpu_model)
return env;
}
+static void pc_cpus_init(const char *cpu_model)
+{
+ int i;
+
+ /* init CPUs */
+ if (cpu_model == NULL) {
+#ifdef TARGET_X86_64
+ cpu_model = "qemu64";
+#else
+ cpu_model = "qemu32";
+#endif
+ }
+
+ for(i = 0; i < smp_cpus; i++) {
+ (void)pc_new_cpu(cpu_model);
+ }
+}
+
static qemu_irq *pc_allocate_cpu_irq(void)
{
return qemu_allocate_irqs(pic_irq_request, NULL, 1);
@@ -1016,7 +1034,6 @@ static void pc_init1(ram_addr_t ram_size,
ISADevice *isa_dev;
PCII440FXState *i440fx_state;
int piix3_devfn = -1;
- CPUState *env;
qemu_irq *cpu_irq;
qemu_irq *isa_irq;
qemu_irq *i8259;
@@ -1037,18 +1054,7 @@ static void pc_init1(ram_addr_t ram_size,
linux_boot = (kernel_filename != NULL);
- /* init CPUs */
- if (cpu_model == NULL) {
-#ifdef TARGET_X86_64
- cpu_model = "qemu64";
-#else
- cpu_model = "qemu32";
-#endif
- }
-
- for (i = 0; i < smp_cpus; i++) {
- env = pc_new_cpu(cpu_model);
- }
+ pc_cpus_init(cpu_model);
vmport_init();
--
1.6.5.4
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [Qemu-devel] [PATCH V11 14/27] pc: split out memory allocation from pc_init1() into pc_memory_init()
2010-01-05 6:27 [Qemu-devel] [PATCH V11 00/27] split out piix specific part from pc emulator and some clean ups Isaku Yamahata
` (12 preceding siblings ...)
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 13/27] pc: split out cpu initialization from pc_init1() into pc_cpus_init() Isaku Yamahata
@ 2010-01-05 6:27 ` Isaku Yamahata
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 15/27] pc: split out vga initialization from pc_init1() into pc_vga_init() Isaku Yamahata
` (13 subsequent siblings)
27 siblings, 0 replies; 32+ messages in thread
From: Isaku Yamahata @ 2010-01-05 6:27 UTC (permalink / raw)
To: qemu-devel, kraxel; +Cc: yamahata
Split out memory allocation and rom/bios loading which doesn't depend
on piix from pc_init1() into pc_memory_init().
Later it will be used.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
hw/pc.c | 74 +++++++++++++++++++++++++++++++++++++++-----------------------
1 files changed, 46 insertions(+), 28 deletions(-)
diff --git a/hw/pc.c b/hw/pc.c
index 90cf0f4..e5bd712 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -1016,34 +1016,19 @@ static qemu_irq *pc_allocate_cpu_irq(void)
return qemu_allocate_irqs(pic_irq_request, NULL, 1);
}
-/* PC hardware initialisation */
-static void pc_init1(ram_addr_t ram_size,
- const char *boot_device,
- const char *kernel_filename,
- const char *kernel_cmdline,
- const char *initrd_filename,
- const char *cpu_model,
- int pci_enabled)
+static void pc_memory_init(ram_addr_t ram_size,
+ const char *kernel_filename,
+ const char *kernel_cmdline,
+ const char *initrd_filename,
+ ram_addr_t *below_4g_mem_size_p,
+ ram_addr_t *above_4g_mem_size_p,
+ void **fw_cfg)
{
char *filename;
int ret, linux_boot, i;
ram_addr_t ram_addr, bios_offset, option_rom_offset;
ram_addr_t below_4g_mem_size, above_4g_mem_size = 0;
int bios_size, isa_bios_size;
- PCIBus *pci_bus;
- ISADevice *isa_dev;
- PCII440FXState *i440fx_state;
- int piix3_devfn = -1;
- qemu_irq *cpu_irq;
- qemu_irq *isa_irq;
- qemu_irq *i8259;
- IsaIrqState *isa_irq_state;
- DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
- DriveInfo *fd[MAX_FD];
- void *fw_cfg;
- fdctrl_t *floppy_controller;
- RTCState *rtc_state;
- PITState *pit;
if (ram_size >= 0xe0000000 ) {
above_4g_mem_size = ram_size - 0xe0000000;
@@ -1051,13 +1036,11 @@ static void pc_init1(ram_addr_t ram_size,
} else {
below_4g_mem_size = ram_size;
}
+ *above_4g_mem_size_p = above_4g_mem_size;
+ *below_4g_mem_size_p = below_4g_mem_size;
linux_boot = (kernel_filename != NULL);
- pc_cpus_init(cpu_model);
-
- vmport_init();
-
/* allocate RAM */
ram_addr = qemu_ram_alloc(0xa0000);
cpu_register_physical_memory(0, 0xa0000, ram_addr);
@@ -1126,15 +1109,50 @@ static void pc_init1(ram_addr_t ram_size,
cpu_register_physical_memory((uint32_t)(-bios_size),
bios_size, bios_offset | IO_MEM_ROM);
- fw_cfg = bochs_bios_init();
+ *fw_cfg = bochs_bios_init();
if (linux_boot) {
- load_linux(fw_cfg, kernel_filename, initrd_filename, kernel_cmdline, below_4g_mem_size);
+ load_linux(*fw_cfg, kernel_filename, initrd_filename, kernel_cmdline, below_4g_mem_size);
}
for (i = 0; i < nb_option_roms; i++) {
rom_add_option(option_rom[i]);
}
+}
+
+/* PC hardware initialisation */
+static void pc_init1(ram_addr_t ram_size,
+ const char *boot_device,
+ const char *kernel_filename,
+ const char *kernel_cmdline,
+ const char *initrd_filename,
+ const char *cpu_model,
+ int pci_enabled)
+{
+ int i;
+ ram_addr_t below_4g_mem_size, above_4g_mem_size;
+ PCIBus *pci_bus;
+ ISADevice *isa_dev;
+ PCII440FXState *i440fx_state;
+ int piix3_devfn = -1;
+ qemu_irq *cpu_irq;
+ qemu_irq *isa_irq;
+ qemu_irq *i8259;
+ IsaIrqState *isa_irq_state;
+ DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
+ DriveInfo *fd[MAX_FD];
+ void *fw_cfg;
+ fdctrl_t *floppy_controller;
+ RTCState *rtc_state;
+ PITState *pit;
+
+ pc_cpus_init(cpu_model);
+
+ vmport_init();
+
+ /* allocate ram and load rom/bios */
+ pc_memory_init(ram_size, kernel_filename, kernel_cmdline, initrd_filename,
+ &below_4g_mem_size, &above_4g_mem_size, &fw_cfg);
cpu_irq = pc_allocate_cpu_irq();
i8259 = i8259_init(cpu_irq[0]);
--
1.6.5.4
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [Qemu-devel] [PATCH V11 15/27] pc: split out vga initialization from pc_init1() into pc_vga_init().
2010-01-05 6:27 [Qemu-devel] [PATCH V11 00/27] split out piix specific part from pc emulator and some clean ups Isaku Yamahata
` (13 preceding siblings ...)
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 14/27] pc: split out memory allocation from pc_init1() into pc_memory_init() Isaku Yamahata
@ 2010-01-05 6:27 ` Isaku Yamahata
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 16/27] pc: split out basic device init from pc_init1() into pc_basic_device_init() Isaku Yamahata
` (12 subsequent siblings)
27 siblings, 0 replies; 32+ messages in thread
From: Isaku Yamahata @ 2010-01-05 6:27 UTC (permalink / raw)
To: qemu-devel, kraxel; +Cc: yamahata
Split out vga initialization which is independent of piix
from pc_init1() as pc_vga_init().
Later it will be used.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
hw/pc.c | 41 +++++++++++++++++++++++------------------
1 files changed, 23 insertions(+), 18 deletions(-)
diff --git a/hw/pc.c b/hw/pc.c
index e5bd712..386f730 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -1120,6 +1120,28 @@ static void pc_memory_init(ram_addr_t ram_size,
}
}
+static void pc_vga_init(PCIBus *pci_bus)
+{
+ if (cirrus_vga_enabled) {
+ if (pci_bus) {
+ pci_cirrus_vga_init(pci_bus);
+ } else {
+ isa_cirrus_vga_init();
+ }
+ } else if (vmsvga_enabled) {
+ if (pci_bus)
+ pci_vmsvga_init(pci_bus);
+ else
+ fprintf(stderr, "%s: vmware_vga: no PCI bus\n", __FUNCTION__);
+ } else if (std_vga_enabled) {
+ if (pci_bus) {
+ pci_vga_init(pci_bus, 0, 0);
+ } else {
+ isa_vga_init();
+ }
+ }
+}
+
/* PC hardware initialisation */
static void pc_init1(ram_addr_t ram_size,
const char *boot_device,
@@ -1178,24 +1200,7 @@ static void pc_init1(ram_addr_t ram_size,
register_ioport_write(0xf0, 1, 1, ioportF0_write, NULL);
- if (cirrus_vga_enabled) {
- if (pci_enabled) {
- pci_cirrus_vga_init(pci_bus);
- } else {
- isa_cirrus_vga_init();
- }
- } else if (vmsvga_enabled) {
- if (pci_enabled)
- pci_vmsvga_init(pci_bus);
- else
- fprintf(stderr, "%s: vmware_vga: no PCI bus\n", __FUNCTION__);
- } else if (std_vga_enabled) {
- if (pci_enabled) {
- pci_vga_init(pci_bus, 0, 0);
- } else {
- isa_vga_init();
- }
- }
+ pc_vga_init(pci_enabled? pci_bus: NULL);
rtc_state = rtc_init(2000);
--
1.6.5.4
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [Qemu-devel] [PATCH V11 16/27] pc: split out basic device init from pc_init1() into pc_basic_device_init()
2010-01-05 6:27 [Qemu-devel] [PATCH V11 00/27] split out piix specific part from pc emulator and some clean ups Isaku Yamahata
` (14 preceding siblings ...)
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 15/27] pc: split out vga initialization from pc_init1() into pc_vga_init() Isaku Yamahata
@ 2010-01-05 6:27 ` Isaku Yamahata
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 17/27] pc: split out pci device init from pc_init1() into pc_pci_device_init() Isaku Yamahata
` (11 subsequent siblings)
27 siblings, 0 replies; 32+ messages in thread
From: Isaku Yamahata @ 2010-01-05 6:27 UTC (permalink / raw)
To: qemu-devel, kraxel; +Cc: yamahata
Split out basic device, i.e. legacy devices like floppy, initialization
from pc_init1() into pc_basic_device_init().
Later it will be used.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
hw/pc.c | 87 +++++++++++++++++++++++++++++++++++---------------------------
1 files changed, 49 insertions(+), 38 deletions(-)
diff --git a/hw/pc.c b/hw/pc.c
index 386f730..dbff7b7 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -1142,6 +1142,53 @@ static void pc_vga_init(PCIBus *pci_bus)
}
}
+static void pc_basic_device_init(qemu_irq *isa_irq,
+ ISADevice **isa_dev,
+ fdctrl_t **floppy_controller,
+ RTCState **rtc_state)
+{
+ int i;
+ DriveInfo *fd[MAX_FD];
+ PITState *pit;
+
+ register_ioport_write(0x80, 1, 1, ioport80_write, NULL);
+
+ register_ioport_write(0xf0, 1, 1, ioportF0_write, NULL);
+
+ *rtc_state = rtc_init(2000);
+
+ qemu_register_boot_set(pc_boot_set, *rtc_state);
+
+ register_ioport_read(0x92, 1, 1, ioport92_read, NULL);
+ register_ioport_write(0x92, 1, 1, ioport92_write, NULL);
+
+ pit = pit_init(0x40, isa_reserve_irq(0));
+ pcspk_init(pit);
+ if (!no_hpet) {
+ hpet_init(isa_irq);
+ }
+
+ for(i = 0; i < MAX_SERIAL_PORTS; i++) {
+ if (serial_hds[i]) {
+ serial_isa_init(i, serial_hds[i]);
+ }
+ }
+
+ for(i = 0; i < MAX_PARALLEL_PORTS; i++) {
+ if (parallel_hds[i]) {
+ parallel_init(i, parallel_hds[i]);
+ }
+ }
+
+ *isa_dev = isa_create_simple("i8042");
+ DMA_init(0);
+
+ for(i = 0; i < MAX_FD; i++) {
+ fd[i] = drive_get(IF_FLOPPY, 0, i);
+ }
+ *floppy_controller = fdctrl_init_isa(fd);
+}
+
/* PC hardware initialisation */
static void pc_init1(ram_addr_t ram_size,
const char *boot_device,
@@ -1162,11 +1209,9 @@ static void pc_init1(ram_addr_t ram_size,
qemu_irq *i8259;
IsaIrqState *isa_irq_state;
DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
- DriveInfo *fd[MAX_FD];
void *fw_cfg;
fdctrl_t *floppy_controller;
RTCState *rtc_state;
- PITState *pit;
pc_cpus_init(cpu_model);
@@ -1195,37 +1240,10 @@ static void pc_init1(ram_addr_t ram_size,
pc_register_ferr_irq(isa_reserve_irq(13));
- /* init basic PC hardware */
- register_ioport_write(0x80, 1, 1, ioport80_write, NULL);
-
- register_ioport_write(0xf0, 1, 1, ioportF0_write, NULL);
-
pc_vga_init(pci_enabled? pci_bus: NULL);
- rtc_state = rtc_init(2000);
-
- qemu_register_boot_set(pc_boot_set, rtc_state);
-
- register_ioport_read(0x92, 1, 1, ioport92_read, NULL);
- register_ioport_write(0x92, 1, 1, ioport92_write, NULL);
-
- pit = pit_init(0x40, isa_reserve_irq(0));
- pcspk_init(pit);
- if (!no_hpet) {
- hpet_init(isa_irq);
- }
-
- for(i = 0; i < MAX_SERIAL_PORTS; i++) {
- if (serial_hds[i]) {
- serial_isa_init(i, serial_hds[i]);
- }
- }
-
- for(i = 0; i < MAX_PARALLEL_PORTS; i++) {
- if (parallel_hds[i]) {
- parallel_init(i, parallel_hds[i]);
- }
- }
+ /* init basic PC hardware */
+ pc_basic_device_init(isa_irq, &isa_dev, &floppy_controller, &rtc_state);
for(i = 0; i < nb_nics; i++) {
NICInfo *nd = &nd_table[i];
@@ -1254,17 +1272,10 @@ static void pc_init1(ram_addr_t ram_size,
}
}
- isa_dev = isa_create_simple("i8042");
- DMA_init(0);
#ifdef HAS_AUDIO
audio_init(pci_enabled ? pci_bus : NULL, isa_irq);
#endif
- for(i = 0; i < MAX_FD; i++) {
- fd[i] = drive_get(IF_FLOPPY, 0, i);
- }
- floppy_controller = fdctrl_init_isa(fd);
-
cmos_init(below_4g_mem_size, above_4g_mem_size, boot_device, hd,
floppy_controller, rtc_state);
--
1.6.5.4
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [Qemu-devel] [PATCH V11 17/27] pc: split out pci device init from pc_init1() into pc_pci_device_init()
2010-01-05 6:27 [Qemu-devel] [PATCH V11 00/27] split out piix specific part from pc emulator and some clean ups Isaku Yamahata
` (15 preceding siblings ...)
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 16/27] pc: split out basic device init from pc_init1() into pc_basic_device_init() Isaku Yamahata
@ 2010-01-05 6:27 ` Isaku Yamahata
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 18/27] pc: split out piix specific part from pc.c into pc_piix.c Isaku Yamahata
` (10 subsequent siblings)
27 siblings, 0 replies; 32+ messages in thread
From: Isaku Yamahata @ 2010-01-05 6:27 UTC (permalink / raw)
To: qemu-devel, kraxel; +Cc: yamahata
Split out pci device initialization from pc_init1() into pc_pci_device_init().
and removed unnecessary braces.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
hw/pc.c | 35 +++++++++++++++++++----------------
1 files changed, 19 insertions(+), 16 deletions(-)
diff --git a/hw/pc.c b/hw/pc.c
index dbff7b7..7ce1fdb 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -1189,6 +1189,24 @@ static void pc_basic_device_init(qemu_irq *isa_irq,
*floppy_controller = fdctrl_init_isa(fd);
}
+static void pc_pci_device_init(PCIBus *pci_bus)
+{
+ int i;
+ int max_bus;
+
+ max_bus = drive_get_max_bus(IF_SCSI);
+ for (i = 0; i <= max_bus; i++) {
+ pci_create_simple(pci_bus, -1, "lsi53c895a");
+ }
+
+ /* Add virtio console devices */
+ for(i = 0; i < MAX_VIRTIO_CONSOLES; i++) {
+ if (virtcon_hds[i]) {
+ pci_create_simple(pci_bus, -1, "virtio-console-pci");
+ }
+ }
+}
+
/* PC hardware initialisation */
static void pc_init1(ram_addr_t ram_size,
const char *boot_device,
@@ -1308,22 +1326,7 @@ static void pc_init1(ram_addr_t ram_size,
}
if (pci_enabled) {
- int max_bus;
- int bus;
-
- max_bus = drive_get_max_bus(IF_SCSI);
- for (bus = 0; bus <= max_bus; bus++) {
- pci_create_simple(pci_bus, -1, "lsi53c895a");
- }
- }
-
- /* Add virtio console devices */
- if (pci_enabled) {
- for(i = 0; i < MAX_VIRTIO_CONSOLES; i++) {
- if (virtcon_hds[i]) {
- pci_create_simple(pci_bus, -1, "virtio-console-pci");
- }
- }
+ pc_pci_device_init(pci_bus);
}
rom_load_fw(fw_cfg);
--
1.6.5.4
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [Qemu-devel] [PATCH V11 18/27] pc: split out piix specific part from pc.c into pc_piix.c
2010-01-05 6:27 [Qemu-devel] [PATCH V11 00/27] split out piix specific part from pc emulator and some clean ups Isaku Yamahata
` (16 preceding siblings ...)
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 17/27] pc: split out pci device init from pc_init1() into pc_pci_device_init() Isaku Yamahata
@ 2010-01-05 6:27 ` Isaku Yamahata
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 19/27] pc: move rtc declarations from pc.h into a dedicated header file Isaku Yamahata
` (9 subsequent siblings)
27 siblings, 0 replies; 32+ messages in thread
From: Isaku Yamahata @ 2010-01-05 6:27 UTC (permalink / raw)
To: qemu-devel, kraxel; +Cc: yamahata
Finally, we can safely split out the piix specific part from pc.c
into pc_piix.c.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
Makefile.target | 2 +-
hw/pc.c | 264 +++++-------------------------------------------------
hw/pc.h | 33 +++++++
hw/pc_piix.c | 251 ++++++++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 310 insertions(+), 240 deletions(-)
create mode 100644 hw/pc_piix.c
diff --git a/Makefile.target b/Makefile.target
index cf82ebf..8833f26 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -195,7 +195,7 @@ obj-i386-y += cirrus_vga.o apic.o ioapic.o parallel.o acpi.o piix_pci.o
obj-i386-y += usb-uhci.o vmmouse.o vmport.o vmware_vga.o hpet.o
obj-i386-y += device-hotplug.o pci-hotplug.o smbios.o wdt_ib700.o
obj-i386-y += ne2000-isa.o
-obj-i386-y += pc_smbus.o pc_apm.o acpi_piix4.o
+obj-i386-y += pc_smbus.o pc_apm.o acpi_piix4.o pc_piix.o
# shared objects
obj-ppc-y = ppc.o ide/core.o ide/qdev.o ide/isa.o ide/pci.o ide/macio.o
diff --git a/hw/pc.c b/hw/pc.c
index 7ce1fdb..12afaf2 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -62,14 +62,7 @@
#define FW_CFG_SMBIOS_ENTRIES (FW_CFG_ARCH_LOCAL + 1)
#define FW_CFG_IRQ0_OVERRIDE (FW_CFG_ARCH_LOCAL + 2)
-#define MAX_IDE_BUS 2
-
-typedef struct isa_irq_state {
- qemu_irq *i8259;
- qemu_irq *ioapic;
-} IsaIrqState;
-
-static void isa_irq_handler(void *opaque, int n, int level)
+void isa_irq_handler(void *opaque, int n, int level)
{
IsaIrqState *isa = (IsaIrqState *)opaque;
@@ -258,9 +251,9 @@ static int pc_boot_set(void *opaque, const char *boot_device)
}
/* 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, DriveInfo **hd_table,
- fdctrl_t *floppy_controller, RTCState *s)
+void pc_cmos_init(ram_addr_t ram_size, ram_addr_t above_4g_mem_size,
+ const char *boot_device, DriveInfo **hd_table,
+ fdctrl_t *floppy_controller, RTCState *s)
{
int nbds, bds[3] = { 0, };
int val;
@@ -926,10 +919,6 @@ static void load_linux(void *fw_cfg,
nb_option_roms++;
}
-static const int ide_iobase[2] = { 0x1f0, 0x170 };
-static const int ide_iobase2[2] = { 0x3f6, 0x376 };
-static const int ide_irq[2] = { 14, 15 };
-
#define NE2000_NB_MAX 6
static const int ne2000_io[NE2000_NB_MAX] = { 0x300, 0x320, 0x340, 0x360,
@@ -940,7 +929,7 @@ static const int parallel_io[MAX_PARALLEL_PORTS] = { 0x378, 0x278, 0x3bc };
static const int parallel_irq[MAX_PARALLEL_PORTS] = { 7, 7, 7 };
#ifdef HAS_AUDIO
-static void audio_init (PCIBus *pci_bus, qemu_irq *pic)
+void pc_audio_init (PCIBus *pci_bus, qemu_irq *pic)
{
struct soundhw *c;
@@ -958,7 +947,7 @@ static void audio_init (PCIBus *pci_bus, qemu_irq *pic)
}
#endif
-static void pc_init_ne2k_isa(NICInfo *nd)
+void pc_init_ne2k_isa(NICInfo *nd)
{
static int nb_ne2k = 0;
@@ -993,7 +982,7 @@ static CPUState *pc_new_cpu(const char *cpu_model)
return env;
}
-static void pc_cpus_init(const char *cpu_model)
+void pc_cpus_init(const char *cpu_model)
{
int i;
@@ -1011,18 +1000,13 @@ static void pc_cpus_init(const char *cpu_model)
}
}
-static qemu_irq *pc_allocate_cpu_irq(void)
-{
- return qemu_allocate_irqs(pic_irq_request, NULL, 1);
-}
-
-static void pc_memory_init(ram_addr_t ram_size,
- const char *kernel_filename,
- const char *kernel_cmdline,
- const char *initrd_filename,
- ram_addr_t *below_4g_mem_size_p,
- ram_addr_t *above_4g_mem_size_p,
- void **fw_cfg)
+void pc_memory_init(ram_addr_t ram_size,
+ const char *kernel_filename,
+ const char *kernel_cmdline,
+ const char *initrd_filename,
+ ram_addr_t *below_4g_mem_size_p,
+ ram_addr_t *above_4g_mem_size_p,
+ void **fw_cfg)
{
char *filename;
int ret, linux_boot, i;
@@ -1120,7 +1104,12 @@ static void pc_memory_init(ram_addr_t ram_size,
}
}
-static void pc_vga_init(PCIBus *pci_bus)
+qemu_irq *pc_allocate_cpu_irq(void)
+{
+ return qemu_allocate_irqs(pic_irq_request, NULL, 1);
+}
+
+void pc_vga_init(PCIBus *pci_bus)
{
if (cirrus_vga_enabled) {
if (pci_bus) {
@@ -1142,10 +1131,10 @@ static void pc_vga_init(PCIBus *pci_bus)
}
}
-static void pc_basic_device_init(qemu_irq *isa_irq,
- ISADevice **isa_dev,
- fdctrl_t **floppy_controller,
- RTCState **rtc_state)
+void pc_basic_device_init(qemu_irq *isa_irq,
+ ISADevice **isa_dev,
+ fdctrl_t **floppy_controller,
+ RTCState **rtc_state)
{
int i;
DriveInfo *fd[MAX_FD];
@@ -1189,7 +1178,7 @@ static void pc_basic_device_init(qemu_irq *isa_irq,
*floppy_controller = fdctrl_init_isa(fd);
}
-static void pc_pci_device_init(PCIBus *pci_bus)
+void pc_pci_device_init(PCIBus *pci_bus)
{
int i;
int max_bus;
@@ -1207,157 +1196,6 @@ static void pc_pci_device_init(PCIBus *pci_bus)
}
}
-/* PC hardware initialisation */
-static void pc_init1(ram_addr_t ram_size,
- const char *boot_device,
- const char *kernel_filename,
- const char *kernel_cmdline,
- const char *initrd_filename,
- const char *cpu_model,
- int pci_enabled)
-{
- int i;
- ram_addr_t below_4g_mem_size, above_4g_mem_size;
- PCIBus *pci_bus;
- ISADevice *isa_dev;
- PCII440FXState *i440fx_state;
- int piix3_devfn = -1;
- qemu_irq *cpu_irq;
- qemu_irq *isa_irq;
- qemu_irq *i8259;
- IsaIrqState *isa_irq_state;
- DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
- void *fw_cfg;
- fdctrl_t *floppy_controller;
- RTCState *rtc_state;
-
- pc_cpus_init(cpu_model);
-
- vmport_init();
-
- /* allocate ram and load rom/bios */
- pc_memory_init(ram_size, kernel_filename, kernel_cmdline, initrd_filename,
- &below_4g_mem_size, &above_4g_mem_size, &fw_cfg);
-
- cpu_irq = pc_allocate_cpu_irq();
- i8259 = i8259_init(cpu_irq[0]);
- isa_irq_state = qemu_mallocz(sizeof(*isa_irq_state));
- isa_irq_state->i8259 = i8259;
- if (pci_enabled) {
- isa_irq_state->ioapic = ioapic_init();
- }
- isa_irq = qemu_allocate_irqs(isa_irq_handler, isa_irq_state, 24);
-
- if (pci_enabled) {
- pci_bus = i440fx_init(&i440fx_state, &piix3_devfn, isa_irq);
- } else {
- pci_bus = NULL;
- isa_bus_new(NULL);
- }
- isa_bus_irqs(isa_irq);
-
- pc_register_ferr_irq(isa_reserve_irq(13));
-
- pc_vga_init(pci_enabled? pci_bus: NULL);
-
- /* init basic PC hardware */
- pc_basic_device_init(isa_irq, &isa_dev, &floppy_controller, &rtc_state);
-
- for(i = 0; i < nb_nics; i++) {
- NICInfo *nd = &nd_table[i];
-
- if (!pci_enabled || (nd->model && strcmp(nd->model, "ne2k_isa") == 0))
- pc_init_ne2k_isa(nd);
- else
- pci_nic_init_nofail(nd, "e1000", NULL);
- }
-
- if (drive_get_max_bus(IF_IDE) >= MAX_IDE_BUS) {
- fprintf(stderr, "qemu: too many IDE bus\n");
- exit(1);
- }
-
- for(i = 0; i < MAX_IDE_BUS * MAX_IDE_DEVS; i++) {
- hd[i] = drive_get(IF_IDE, i / MAX_IDE_DEVS, i % MAX_IDE_DEVS);
- }
-
- if (pci_enabled) {
- pci_piix3_ide_init(pci_bus, hd, piix3_devfn + 1);
- } else {
- for(i = 0; i < MAX_IDE_BUS; i++) {
- isa_ide_init(ide_iobase[i], ide_iobase2[i], ide_irq[i],
- hd[MAX_IDE_DEVS * i], hd[MAX_IDE_DEVS * i + 1]);
- }
- }
-
-#ifdef HAS_AUDIO
- audio_init(pci_enabled ? pci_bus : NULL, isa_irq);
-#endif
-
- cmos_init(below_4g_mem_size, above_4g_mem_size, boot_device, hd,
- floppy_controller, rtc_state);
-
- if (pci_enabled && usb_enabled) {
- usb_uhci_piix3_init(pci_bus, piix3_devfn + 2);
- }
-
- if (pci_enabled && acpi_enabled) {
- uint8_t *eeprom_buf = qemu_mallocz(8 * 256); /* XXX: make this persistent */
- i2c_bus *smbus;
-
- qemu_irq cmos_s3_resume =
- *qemu_allocate_irqs(cmos_set_s3_resume_fn, rtc_state, 1);
-
- /* TODO: Populate SPD eeprom data. */
- smbus = piix4_pm_init(pci_bus, piix3_devfn + 3, 0xb100,
- isa_reserve_irq(9), cmos_s3_resume);
- for (i = 0; i < 8; i++) {
- DeviceState *eeprom;
- eeprom = qdev_create((BusState *)smbus, "smbus-eeprom");
- qdev_prop_set_uint8(eeprom, "address", 0x50 + i);
- qdev_prop_set_ptr(eeprom, "data", eeprom_buf + (i * 256));
- qdev_init_nofail(eeprom);
- }
- piix4_acpi_system_hot_add_init(pci_bus);
- }
-
- if (i440fx_state) {
- i440fx_init_memory_mappings(i440fx_state);
- }
-
- if (pci_enabled) {
- pc_pci_device_init(pci_bus);
- }
-
- rom_load_fw(fw_cfg);
-}
-
-static void pc_init_pci(ram_addr_t ram_size,
- const char *boot_device,
- const char *kernel_filename,
- const char *kernel_cmdline,
- const char *initrd_filename,
- const char *cpu_model)
-{
- pc_init1(ram_size, boot_device,
- kernel_filename, kernel_cmdline,
- initrd_filename, cpu_model, 1);
-}
-
-static void pc_init_isa(ram_addr_t ram_size,
- const char *boot_device,
- const char *kernel_filename,
- const char *kernel_cmdline,
- const char *initrd_filename,
- const char *cpu_model)
-{
- if (cpu_model == NULL)
- cpu_model = "486";
- pc_init1(ram_size, boot_device,
- kernel_filename, kernel_cmdline,
- initrd_filename, cpu_model, 0);
-}
-
/* set CMOS shutdown status register (index 0xF) as S3_resume(0xFE)
BIOS will read it and start S3 resume at POST Entry */
void cmos_set_s3_resume_fn(void *opaque, int n, int level)
@@ -1365,55 +1203,3 @@ void cmos_set_s3_resume_fn(void *opaque, int n, int level)
RTCState *rtc_state = opaque;
rtc_set_memory(rtc_state, 0xF, 0xFE);
}
-
-static QEMUMachine pc_machine = {
- .name = "pc-0.11",
- .alias = "pc",
- .desc = "Standard PC",
- .init = pc_init_pci,
- .max_cpus = 255,
- .is_default = 1,
-};
-
-static QEMUMachine pc_machine_v0_10 = {
- .name = "pc-0.10",
- .desc = "Standard PC, qemu 0.10",
- .init = pc_init_pci,
- .max_cpus = 255,
- .compat_props = (GlobalProperty[]) {
- {
- .driver = "virtio-blk-pci",
- .property = "class",
- .value = stringify(PCI_CLASS_STORAGE_OTHER),
- },{
- .driver = "virtio-console-pci",
- .property = "class",
- .value = stringify(PCI_CLASS_DISPLAY_OTHER),
- },{
- .driver = "virtio-net-pci",
- .property = "vectors",
- .value = stringify(0),
- },{
- .driver = "virtio-blk-pci",
- .property = "vectors",
- .value = stringify(0),
- },
- { /* end of list */ }
- },
-};
-
-static QEMUMachine isapc_machine = {
- .name = "isapc",
- .desc = "ISA-only PC",
- .init = pc_init_isa,
- .max_cpus = 1,
-};
-
-static void pc_machine_init(void)
-{
- qemu_register_machine(&pc_machine);
- qemu_register_machine(&pc_machine_v0_10);
- qemu_register_machine(&isapc_machine);
-}
-
-machine_init(pc_machine_init);
diff --git a/hw/pc.h b/hw/pc.h
index 6791b0b..7b7639c 100644
--- a/hw/pc.h
+++ b/hw/pc.h
@@ -2,6 +2,7 @@
#define HW_PC_H
#include "qemu-common.h"
+#include "isa.h"
/* PC-style peripherals (also used by other machines). */
@@ -34,6 +35,14 @@ uint32_t pic_intack_read(PicState2 *s);
void pic_info(Monitor *mon);
void irq_info(Monitor *mon);
+/* ISA */
+typedef struct isa_irq_state {
+ qemu_irq *i8259;
+ qemu_irq *ioapic;
+} IsaIrqState;
+
+void isa_irq_handler(void *opaque, int n, int level);
+
/* APIC */
typedef struct IOAPICState IOAPICState;
void apic_deliver_irq(uint8_t dest, uint8_t dest_mode,
@@ -93,6 +102,30 @@ extern int fd_bootchk;
void pc_register_ferr_irq(qemu_irq irq);
+void pc_cpus_init(const char *cpu_model);
+void pc_memory_init(ram_addr_t ram_size,
+ const char *kernel_filename,
+ const char *kernel_cmdline,
+ const char *initrd_filename,
+ ram_addr_t *below_4g_mem_size_p,
+ ram_addr_t *above_4g_mem_size_p,
+ void **fw_cfg);
+qemu_irq *pc_allocate_cpu_irq(void);
+void pc_vga_init(PCIBus *pci_bus);
+struct fdctrl_t;
+void pc_basic_device_init(qemu_irq *isa_irq,
+ ISADevice **isa_dev,
+ struct fdctrl_t **floppy_controller,
+ RTCState **rtc_state);
+void pc_init_ne2k_isa(NICInfo *nd);
+#ifdef HAS_AUDIO
+void pc_audio_init (PCIBus *pci_bus, qemu_irq *pic);
+#endif
+void pc_cmos_init(ram_addr_t ram_size, ram_addr_t above_4g_mem_size,
+ const char *boot_device, DriveInfo **hd_table,
+ struct fdctrl_t *floppy_controller, RTCState *s);
+void pc_pci_device_init(PCIBus *pci_bus);
+
void ioport_set_a20(int enable);
int ioport_get_a20(void);
diff --git a/hw/pc_piix.c b/hw/pc_piix.c
new file mode 100644
index 0000000..69ba02b
--- /dev/null
+++ b/hw/pc_piix.c
@@ -0,0 +1,251 @@
+/*
+ * QEMU PC System Emulator
+ *
+ * Copyright (c) 2003-2004 Fabrice Bellard
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include "hw.h"
+#include "pc.h"
+#include "fdc.h"
+#include "pci.h"
+#include "usb-uhci.h"
+#include "usb-ohci.h"
+#include "block.h"
+#include "sysemu.h"
+#include "audio/audio.h"
+#include "net.h"
+#include "smbus.h"
+#include "boards.h"
+#include "monitor.h"
+#include "fw_cfg.h"
+#include "hpet_emul.h"
+#include "smbios.h"
+#include "ide.h"
+#include "loader.h"
+
+#define MAX_IDE_BUS 2
+
+static const int ide_iobase[MAX_IDE_BUS] = { 0x1f0, 0x170 };
+static const int ide_iobase2[MAX_IDE_BUS] = { 0x3f6, 0x376 };
+static const int ide_irq[MAX_IDE_BUS] = { 14, 15 };
+
+/* PC hardware initialisation */
+static void pc_init1(ram_addr_t ram_size,
+ const char *boot_device,
+ const char *kernel_filename,
+ const char *kernel_cmdline,
+ const char *initrd_filename,
+ const char *cpu_model,
+ int pci_enabled)
+{
+ int i;
+ ram_addr_t below_4g_mem_size, above_4g_mem_size;
+ PCIBus *pci_bus;
+ ISADevice *isa_dev;
+ PCII440FXState *i440fx_state;
+ int piix3_devfn = -1;
+ qemu_irq *cpu_irq;
+ qemu_irq *isa_irq;
+ qemu_irq *i8259;
+ IsaIrqState *isa_irq_state;
+ DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
+ void *fw_cfg;
+ fdctrl_t *floppy_controller;
+ RTCState *rtc_state;
+
+ pc_cpus_init(cpu_model);
+
+ vmport_init();
+
+ /* allocate ram and load rom/bios */
+ pc_memory_init(ram_size, kernel_filename, kernel_cmdline, initrd_filename,
+ &below_4g_mem_size, &above_4g_mem_size, &fw_cfg);
+
+ cpu_irq = pc_allocate_cpu_irq();
+ i8259 = i8259_init(cpu_irq[0]);
+ isa_irq_state = qemu_mallocz(sizeof(*isa_irq_state));
+ isa_irq_state->i8259 = i8259;
+ if (pci_enabled) {
+ isa_irq_state->ioapic = ioapic_init();
+ }
+ isa_irq = qemu_allocate_irqs(isa_irq_handler, isa_irq_state, 24);
+
+ if (pci_enabled) {
+ pci_bus = i440fx_init(&i440fx_state, &piix3_devfn, isa_irq);
+ } else {
+ pci_bus = NULL;
+ isa_bus_new(NULL);
+ }
+ isa_bus_irqs(isa_irq);
+
+ pc_register_ferr_irq(isa_reserve_irq(13));
+
+ pc_vga_init(pci_enabled? pci_bus: NULL);
+
+ /* init basic PC hardware */
+ pc_basic_device_init(isa_irq, &isa_dev, &floppy_controller, &rtc_state);
+
+ for(i = 0; i < nb_nics; i++) {
+ NICInfo *nd = &nd_table[i];
+
+ if (!pci_enabled || (nd->model && strcmp(nd->model, "ne2k_isa") == 0))
+ pc_init_ne2k_isa(nd);
+ else
+ pci_nic_init_nofail(nd, "e1000", NULL);
+ }
+
+ if (drive_get_max_bus(IF_IDE) >= MAX_IDE_BUS) {
+ fprintf(stderr, "qemu: too many IDE bus\n");
+ exit(1);
+ }
+
+ for(i = 0; i < MAX_IDE_BUS * MAX_IDE_DEVS; i++) {
+ hd[i] = drive_get(IF_IDE, i / MAX_IDE_DEVS, i % MAX_IDE_DEVS);
+ }
+
+ if (pci_enabled) {
+ pci_piix3_ide_init(pci_bus, hd, piix3_devfn + 1);
+ } else {
+ for(i = 0; i < MAX_IDE_BUS; i++) {
+ isa_ide_init(ide_iobase[i], ide_iobase2[i], ide_irq[i],
+ hd[MAX_IDE_DEVS * i], hd[MAX_IDE_DEVS * i + 1]);
+ }
+ }
+
+#ifdef HAS_AUDIO
+ pc_audio_init(pci_enabled ? pci_bus : NULL, isa_irq);
+#endif
+
+ pc_cmos_init(below_4g_mem_size, above_4g_mem_size, boot_device, hd,
+ floppy_controller, rtc_state);
+
+ if (pci_enabled && usb_enabled) {
+ usb_uhci_piix3_init(pci_bus, piix3_devfn + 2);
+ }
+
+ if (pci_enabled && acpi_enabled) {
+ uint8_t *eeprom_buf = qemu_mallocz(8 * 256); /* XXX: make this persistent */
+ i2c_bus *smbus;
+
+ qemu_irq cmos_s3_resume =
+ *qemu_allocate_irqs(cmos_set_s3_resume_fn, rtc_state, 1);
+
+ /* TODO: Populate SPD eeprom data. */
+ smbus = piix4_pm_init(pci_bus, piix3_devfn + 3, 0xb100,
+ isa_reserve_irq(9), cmos_s3_resume);
+ for (i = 0; i < 8; i++) {
+ DeviceState *eeprom;
+ eeprom = qdev_create((BusState *)smbus, "smbus-eeprom");
+ qdev_prop_set_uint8(eeprom, "address", 0x50 + i);
+ qdev_prop_set_ptr(eeprom, "data", eeprom_buf + (i * 256));
+ qdev_init_nofail(eeprom);
+ }
+ piix4_acpi_system_hot_add_init(pci_bus);
+ }
+
+ if (i440fx_state) {
+ i440fx_init_memory_mappings(i440fx_state);
+ }
+
+ if (pci_enabled) {
+ pc_pci_device_init(pci_bus);
+ }
+
+ rom_load_fw(fw_cfg);
+}
+
+static void pc_init_pci(ram_addr_t ram_size,
+ const char *boot_device,
+ const char *kernel_filename,
+ const char *kernel_cmdline,
+ const char *initrd_filename,
+ const char *cpu_model)
+{
+ pc_init1(ram_size, boot_device,
+ kernel_filename, kernel_cmdline,
+ initrd_filename, cpu_model, 1);
+}
+
+static void pc_init_isa(ram_addr_t ram_size,
+ const char *boot_device,
+ const char *kernel_filename,
+ const char *kernel_cmdline,
+ const char *initrd_filename,
+ const char *cpu_model)
+{
+ if (cpu_model == NULL)
+ cpu_model = "486";
+ pc_init1(ram_size, boot_device,
+ kernel_filename, kernel_cmdline,
+ initrd_filename, cpu_model, 0);
+}
+
+static QEMUMachine pc_machine = {
+ .name = "pc-0.11",
+ .alias = "pc",
+ .desc = "Standard PC",
+ .init = pc_init_pci,
+ .max_cpus = 255,
+ .is_default = 1,
+};
+
+static QEMUMachine pc_machine_v0_10 = {
+ .name = "pc-0.10",
+ .desc = "Standard PC, qemu 0.10",
+ .init = pc_init_pci,
+ .max_cpus = 255,
+ .compat_props = (GlobalProperty[]) {
+ {
+ .driver = "virtio-blk-pci",
+ .property = "class",
+ .value = stringify(PCI_CLASS_STORAGE_OTHER),
+ },{
+ .driver = "virtio-console-pci",
+ .property = "class",
+ .value = stringify(PCI_CLASS_DISPLAY_OTHER),
+ },{
+ .driver = "virtio-net-pci",
+ .property = "vectors",
+ .value = stringify(0),
+ },{
+ .driver = "virtio-blk-pci",
+ .property = "vectors",
+ .value = stringify(0),
+ },
+ { /* end of list */ }
+ },
+};
+
+static QEMUMachine isapc_machine = {
+ .name = "isapc",
+ .desc = "ISA-only PC",
+ .init = pc_init_isa,
+ .max_cpus = 1,
+};
+
+static void pc_machine_init(void)
+{
+ qemu_register_machine(&pc_machine);
+ qemu_register_machine(&pc_machine_v0_10);
+ qemu_register_machine(&isapc_machine);
+}
+
+machine_init(pc_machine_init);
--
1.6.5.4
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [Qemu-devel] [PATCH V11 19/27] pc: move rtc declarations from pc.h into a dedicated header file.
2010-01-05 6:27 [Qemu-devel] [PATCH V11 00/27] split out piix specific part from pc emulator and some clean ups Isaku Yamahata
` (17 preceding siblings ...)
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 18/27] pc: split out piix specific part from pc.c into pc_piix.c Isaku Yamahata
@ 2010-01-05 6:27 ` Isaku Yamahata
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 20/27] rtc: make rtc_xxx accept/return ISADevice instead of RTCState Isaku Yamahata
` (8 subsequent siblings)
27 siblings, 0 replies; 32+ messages in thread
From: Isaku Yamahata @ 2010-01-05 6:27 UTC (permalink / raw)
To: qemu-devel, kraxel; +Cc: yamahata
Move rtc_xxx declarations from pc.h into mc146818rtc.h.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
hw/mc146818rtc.h | 10 ++++++++++
hw/pc.h | 10 ++--------
2 files changed, 12 insertions(+), 8 deletions(-)
create mode 100644 hw/mc146818rtc.h
diff --git a/hw/mc146818rtc.h b/hw/mc146818rtc.h
new file mode 100644
index 0000000..7211dae
--- /dev/null
+++ b/hw/mc146818rtc.h
@@ -0,0 +1,10 @@
+#ifndef MC146818RTC_H
+#define MC146818RTC_H
+
+typedef struct RTCState RTCState;
+
+RTCState *rtc_init(int base_year);
+void rtc_set_memory(RTCState *s, int addr, int val);
+void rtc_set_date(RTCState *s, const struct tm *tm);
+
+#endif /* !MC146818RTC_H */
diff --git a/hw/pc.h b/hw/pc.h
index 7b7639c..b748615 100644
--- a/hw/pc.h
+++ b/hw/pc.h
@@ -3,6 +3,7 @@
#include "qemu-common.h"
#include "isa.h"
+#include "mc146818rtc.h"
/* PC-style peripherals (also used by other machines). */
@@ -88,16 +89,9 @@ void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq,
target_phys_addr_t base, ram_addr_t size,
target_phys_addr_t mask);
-/* mc146818rtc.c */
-
-typedef struct RTCState RTCState;
-
-RTCState *rtc_init(int base_year);
-void rtc_set_memory(RTCState *s, int addr, int val);
-void rtc_set_date(RTCState *s, const struct tm *tm);
+/* pc.c */
void cmos_set_s3_resume_fn(void *opaque, int n, int level);
-/* pc.c */
extern int fd_bootchk;
void pc_register_ferr_irq(qemu_irq irq);
--
1.6.5.4
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [Qemu-devel] [PATCH V11 20/27] rtc: make rtc_xxx accept/return ISADevice instead of RTCState.
2010-01-05 6:27 [Qemu-devel] [PATCH V11 00/27] split out piix specific part from pc emulator and some clean ups Isaku Yamahata
` (18 preceding siblings ...)
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 19/27] pc: move rtc declarations from pc.h into a dedicated header file Isaku Yamahata
@ 2010-01-05 6:27 ` Isaku Yamahata
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 21/27] acpi_piix4: qdevfy Isaku Yamahata
` (7 subsequent siblings)
27 siblings, 0 replies; 32+ messages in thread
From: Isaku Yamahata @ 2010-01-05 6:27 UTC (permalink / raw)
To: qemu-devel, kraxel; +Cc: yamahata
To match rtc_xxx with qdev, make rtc_xxx accept and return ISADevice
instead of RTCState.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
hw/mc146818rtc.c | 26 +++++++++++++++-----------
hw/mc146818rtc.h | 8 ++++----
hw/mips_jazz.c | 1 +
hw/mips_malta.c | 3 ++-
hw/mips_r4k.c | 3 ++-
hw/pc.c | 11 ++++++-----
hw/pc.h | 5 ++---
hw/pc_piix.c | 2 +-
hw/ppc_prep.c | 1 +
9 files changed, 34 insertions(+), 26 deletions(-)
diff --git a/hw/mc146818rtc.c b/hw/mc146818rtc.c
index e4d55c7..1eb991c 100644
--- a/hw/mc146818rtc.c
+++ b/hw/mc146818rtc.c
@@ -27,6 +27,7 @@
#include "pc.h"
#include "isa.h"
#include "hpet_emul.h"
+#include "mc146818rtc.h"
//#define DEBUG_CMOS
@@ -64,7 +65,7 @@
#define REG_C_PF 0x40
#define REG_C_AF 0x20
-struct RTCState {
+typedef struct RTCState {
ISADevice dev;
uint8_t cmos_data[128];
uint8_t cmos_index;
@@ -84,7 +85,7 @@ struct RTCState {
QEMUTimer *coalesced_timer;
QEMUTimer *second_timer;
QEMUTimer *second_timer2;
-};
+} RTCState;
static void rtc_irq_raise(qemu_irq irq)
{
@@ -489,14 +490,16 @@ static uint32_t cmos_ioport_read(void *opaque, uint32_t addr)
}
}
-void rtc_set_memory(RTCState *s, int addr, int val)
+void rtc_set_memory(ISADevice *dev, int addr, int val)
{
+ RTCState *s = DO_UPCAST(RTCState, dev, dev);
if (addr >= 0 && addr <= 127)
s->cmos_data[addr] = val;
}
-void rtc_set_date(RTCState *s, const struct tm *tm)
+void rtc_set_date(ISADevice *dev, const struct tm *tm)
{
+ RTCState *s = DO_UPCAST(RTCState, dev, dev);
s->current_tm = *tm;
rtc_copy_date(s);
}
@@ -505,18 +508,19 @@ void rtc_set_date(RTCState *s, const struct tm *tm)
#define REG_IBM_CENTURY_BYTE 0x32
#define REG_IBM_PS2_CENTURY_BYTE 0x37
-static void rtc_set_date_from_host(RTCState *s)
+static void rtc_set_date_from_host(ISADevice *dev)
{
+ RTCState *s = DO_UPCAST(RTCState, dev, dev);
struct tm tm;
int val;
/* set the CMOS date */
qemu_get_timedate(&tm, 0);
- rtc_set_date(s, &tm);
+ rtc_set_date(dev, &tm);
val = rtc_to_bcd(s, (tm.tm_year / 100) + 19);
- rtc_set_memory(s, REG_IBM_CENTURY_BYTE, val);
- rtc_set_memory(s, REG_IBM_PS2_CENTURY_BYTE, val);
+ rtc_set_memory(dev, REG_IBM_CENTURY_BYTE, val);
+ rtc_set_memory(dev, REG_IBM_PS2_CENTURY_BYTE, val);
}
static int rtc_post_load(void *opaque, int version_id)
@@ -588,7 +592,7 @@ static int rtc_initfn(ISADevice *dev)
s->cmos_data[RTC_REG_C] = 0x00;
s->cmos_data[RTC_REG_D] = 0x80;
- rtc_set_date_from_host(s);
+ rtc_set_date_from_host(dev);
s->periodic_timer = qemu_new_timer(rtc_clock, rtc_periodic_timer, s);
#ifdef TARGET_I386
@@ -611,14 +615,14 @@ static int rtc_initfn(ISADevice *dev)
return 0;
}
-RTCState *rtc_init(int base_year)
+ISADevice *rtc_init(int base_year)
{
ISADevice *dev;
dev = isa_create("mc146818rtc");
qdev_prop_set_int32(&dev->qdev, "base_year", base_year);
qdev_init_nofail(&dev->qdev);
- return DO_UPCAST(RTCState, dev, dev);
+ return dev;
}
static ISADeviceInfo mc146818rtc_info = {
diff --git a/hw/mc146818rtc.h b/hw/mc146818rtc.h
index 7211dae..6f46a68 100644
--- a/hw/mc146818rtc.h
+++ b/hw/mc146818rtc.h
@@ -1,10 +1,10 @@
#ifndef MC146818RTC_H
#define MC146818RTC_H
-typedef struct RTCState RTCState;
+#include "isa.h"
-RTCState *rtc_init(int base_year);
-void rtc_set_memory(RTCState *s, int addr, int val);
-void rtc_set_date(RTCState *s, const struct tm *tm);
+ISADevice *rtc_init(int base_year);
+void rtc_set_memory(ISADevice *dev, int addr, int val);
+void rtc_set_date(ISADevice *dev, const struct tm *tm);
#endif /* !MC146818RTC_H */
diff --git a/hw/mips_jazz.c b/hw/mips_jazz.c
index 94ebd36..cd63fc9 100644
--- a/hw/mips_jazz.c
+++ b/hw/mips_jazz.c
@@ -34,6 +34,7 @@
#include "esp.h"
#include "mips-bios.h"
#include "loader.h"
+#include "mc146818rtc.h"
enum jazz_model_e
{
diff --git a/hw/mips_malta.c b/hw/mips_malta.c
index a507bc7..8f33e74 100644
--- a/hw/mips_malta.c
+++ b/hw/mips_malta.c
@@ -43,6 +43,7 @@
#include "ide.h"
#include "loader.h"
#include "elf.h"
+#include "mc146818rtc.h"
//#define DEBUG_BOARD_INIT
@@ -779,7 +780,7 @@ void mips_malta_init (ram_addr_t ram_size,
PCIBus *pci_bus;
ISADevice *isa_dev;
CPUState *env;
- RTCState *rtc_state;
+ ISADevice *rtc_state;
fdctrl_t *floppy_controller;
MaltaFPGAState *malta_fpga;
qemu_irq *i8259;
diff --git a/hw/mips_r4k.c b/hw/mips_r4k.c
index b69d7c3..104cf29 100644
--- a/hw/mips_r4k.c
+++ b/hw/mips_r4k.c
@@ -20,6 +20,7 @@
#include "ide.h"
#include "loader.h"
#include "elf.h"
+#include "mc146818rtc.h"
#define PHYS_TO_VIRT(x) ((x) | ~(target_ulong)0x7fffffff)
@@ -167,7 +168,7 @@ void mips_r4k_init (ram_addr_t ram_size,
int bios_size;
CPUState *env;
ResetData *reset_info;
- RTCState *rtc_state;
+ ISADevice *rtc_state;
int i;
qemu_irq *i8259;
DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
diff --git a/hw/pc.c b/hw/pc.c
index 12afaf2..bf8d272 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -44,6 +44,7 @@
#include "ide.h"
#include "loader.h"
#include "elf.h"
+#include "mc146818rtc.h"
/* output Bochs bios info messages */
//#define DEBUG_BIOS
@@ -189,7 +190,7 @@ static int cmos_get_fd_drive_type(int fd0)
}
static void cmos_init_hd(int type_ofs, int info_ofs, BlockDriverState *hd,
- RTCState *s)
+ ISADevice *s)
{
int cylinders, heads, sectors;
bdrv_get_geometry_hint(hd, &cylinders, &heads, §ors);
@@ -228,7 +229,7 @@ static int pc_boot_set(void *opaque, const char *boot_device)
{
Monitor *mon = cur_mon;
#define PC_MAX_BOOT_DEVICES 3
- RTCState *s = (RTCState *)opaque;
+ ISADevice *s = opaque;
int nbds, bds[3] = { 0, };
int i;
@@ -253,7 +254,7 @@ static int pc_boot_set(void *opaque, const char *boot_device)
/* hd_table must contain 4 block drivers */
void pc_cmos_init(ram_addr_t ram_size, ram_addr_t above_4g_mem_size,
const char *boot_device, DriveInfo **hd_table,
- fdctrl_t *floppy_controller, RTCState *s)
+ fdctrl_t *floppy_controller, ISADevice *s)
{
int nbds, bds[3] = { 0, };
int val;
@@ -1134,7 +1135,7 @@ void pc_vga_init(PCIBus *pci_bus)
void pc_basic_device_init(qemu_irq *isa_irq,
ISADevice **isa_dev,
fdctrl_t **floppy_controller,
- RTCState **rtc_state)
+ ISADevice **rtc_state)
{
int i;
DriveInfo *fd[MAX_FD];
@@ -1200,6 +1201,6 @@ void pc_pci_device_init(PCIBus *pci_bus)
BIOS will read it and start S3 resume at POST Entry */
void cmos_set_s3_resume_fn(void *opaque, int n, int level)
{
- RTCState *rtc_state = opaque;
+ ISADevice *rtc_state = opaque;
rtc_set_memory(rtc_state, 0xF, 0xFE);
}
diff --git a/hw/pc.h b/hw/pc.h
index b748615..2088cfd 100644
--- a/hw/pc.h
+++ b/hw/pc.h
@@ -3,7 +3,6 @@
#include "qemu-common.h"
#include "isa.h"
-#include "mc146818rtc.h"
/* PC-style peripherals (also used by other machines). */
@@ -110,14 +109,14 @@ struct fdctrl_t;
void pc_basic_device_init(qemu_irq *isa_irq,
ISADevice **isa_dev,
struct fdctrl_t **floppy_controller,
- RTCState **rtc_state);
+ ISADevice **rtc_state);
void pc_init_ne2k_isa(NICInfo *nd);
#ifdef HAS_AUDIO
void pc_audio_init (PCIBus *pci_bus, qemu_irq *pic);
#endif
void pc_cmos_init(ram_addr_t ram_size, ram_addr_t above_4g_mem_size,
const char *boot_device, DriveInfo **hd_table,
- struct fdctrl_t *floppy_controller, RTCState *s);
+ struct fdctrl_t *floppy_controller, ISADevice *s);
void pc_pci_device_init(PCIBus *pci_bus);
void ioport_set_a20(int enable);
diff --git a/hw/pc_piix.c b/hw/pc_piix.c
index 69ba02b..682b64c 100644
--- a/hw/pc_piix.c
+++ b/hw/pc_piix.c
@@ -69,7 +69,7 @@ static void pc_init1(ram_addr_t ram_size,
DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
void *fw_cfg;
fdctrl_t *floppy_controller;
- RTCState *rtc_state;
+ ISADevice *rtc_state;
pc_cpus_init(cpu_model);
diff --git a/hw/ppc_prep.c b/hw/ppc_prep.c
index eb758f2..cf0db83 100644
--- a/hw/ppc_prep.c
+++ b/hw/ppc_prep.c
@@ -36,6 +36,7 @@
#include "qemu-log.h"
#include "ide.h"
#include "loader.h"
+#include "mc146818rtc.h"
//#define HARD_DEBUG_PPC_IO
//#define DEBUG_PPC_IO
--
1.6.5.4
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [Qemu-devel] [PATCH V11 21/27] acpi_piix4: qdevfy.
2010-01-05 6:27 [Qemu-devel] [PATCH V11 00/27] split out piix specific part from pc emulator and some clean ups Isaku Yamahata
` (19 preceding siblings ...)
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 20/27] rtc: make rtc_xxx accept/return ISADevice instead of RTCState Isaku Yamahata
@ 2010-01-05 6:27 ` Isaku Yamahata
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 22/27] pci hotplug: add argument to pci hot plug callback Isaku Yamahata
` (6 subsequent siblings)
27 siblings, 0 replies; 32+ messages in thread
From: Isaku Yamahata @ 2010-01-05 6:27 UTC (permalink / raw)
To: qemu-devel, kraxel; +Cc: yamahata
qdevfy acpi_piix4.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
changes v10 -> v11:
- pass DeviceState of piix4-pm to pc_smbus_init().
Now info qtree shows smbus.
---
hw/acpi_piix4.c | 56 ++++++++++++++++++++++++++++++++++++++++++------------
1 files changed, 43 insertions(+), 13 deletions(-)
diff --git a/hw/acpi_piix4.c b/hw/acpi_piix4.c
index c24e358..6f26600 100644
--- a/hw/acpi_piix4.c
+++ b/hw/acpi_piix4.c
@@ -43,6 +43,7 @@ typedef struct PIIX4PMState {
int64_t tmr_overflow_time;
PCSMBus smb;
+ uint32_t smb_io_base;
qemu_irq irq;
qemu_irq cmos_s3_resume;
@@ -317,15 +318,11 @@ static void piix4_powerdown(void *opaque, int irq, int power_failing)
#endif
}
-i2c_bus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
- qemu_irq sci_irq, qemu_irq cmos_s3_resume)
+static int piix4_pm_initfn(PCIDevice *dev)
{
- PIIX4PMState *s;
+ PIIX4PMState *s = DO_UPCAST(PIIX4PMState, dev, dev);
uint8_t *pci_conf;
- s = (PIIX4PMState *)pci_register_device(bus,
- "PM", sizeof(PIIX4PMState),
- devfn, NULL, pm_write_config);
pm_state = s;
pci_conf = s->dev.config;
pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_INTEL);
@@ -358,26 +355,59 @@ i2c_bus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
pci_conf[0x67] = (serial_hds[0] != NULL ? 0x08 : 0) |
(serial_hds[1] != NULL ? 0x90 : 0);
- pci_conf[0x90] = smb_io_base | 1;
- pci_conf[0x91] = smb_io_base >> 8;
+ pci_conf[0x90] = s->smb_io_base | 1;
+ pci_conf[0x91] = s->smb_io_base >> 8;
pci_conf[0xd2] = 0x09;
- register_ioport_write(smb_io_base, 64, 1, smb_ioport_writeb, &s->smb);
- register_ioport_read(smb_io_base, 64, 1, smb_ioport_readb, &s->smb);
+ register_ioport_write(s->smb_io_base, 64, 1, smb_ioport_writeb, &s->smb);
+ register_ioport_read(s->smb_io_base, 64, 1, smb_ioport_readb, &s->smb);
s->tmr_timer = qemu_new_timer(vm_clock, pm_tmr_timer, s);
qemu_system_powerdown = *qemu_allocate_irqs(piix4_powerdown, s, 1);
- vmstate_register(0, &vmstate_acpi, s);
+ pc_smbus_init(&s->dev.qdev, &s->smb);
+ qemu_register_reset(piix4_reset, s);
+
+ return 0;
+}
+
+i2c_bus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
+ qemu_irq sci_irq, qemu_irq cmos_s3_resume)
+{
+ PCIDevice *dev;
+ PIIX4PMState *s;
+
+ dev = pci_create(bus, devfn, "PIIX4_PM");
+ qdev_prop_set_uint32(&dev->qdev, "smb_io_base", smb_io_base);
+ qdev_init_nofail(&dev->qdev);
- pc_smbus_init(NULL, &s->smb);
+ s = DO_UPCAST(PIIX4PMState, dev, dev);
s->irq = sci_irq;
s->cmos_s3_resume = cmos_s3_resume;
- qemu_register_reset(piix4_reset, s);
return s->smb.smbus;
}
+static PCIDeviceInfo piix4_pm_info = {
+ .qdev.name = "PIIX4_PM",
+ .qdev.desc = "PM",
+ .qdev.size = sizeof(PIIX4PMState),
+ .qdev.vmsd = &vmstate_acpi,
+ .init = piix4_pm_initfn,
+ .config_write = pm_write_config,
+ .qdev.props = (Property[]) {
+ DEFINE_PROP_UINT32("smb_io_base", PIIX4PMState, smb_io_base, 0),
+ DEFINE_PROP_END_OF_LIST(),
+ }
+};
+
+static void piix4_pm_register(void)
+{
+ pci_qdev_register(&piix4_pm_info);
+}
+
+device_init(piix4_pm_register);
+
#define GPE_BASE 0xafe0
#define PCI_BASE 0xae00
#define PCI_EJ_BASE 0xae08
--
1.6.5.4
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [Qemu-devel] [PATCH V11 22/27] pci hotplug: add argument to pci hot plug callback.
2010-01-05 6:27 [Qemu-devel] [PATCH V11 00/27] split out piix specific part from pc emulator and some clean ups Isaku Yamahata
` (20 preceding siblings ...)
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 21/27] acpi_piix4: qdevfy Isaku Yamahata
@ 2010-01-05 6:27 ` Isaku Yamahata
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 23/27] pci hotadd, acpi_piix4: remove global variables Isaku Yamahata
` (5 subsequent siblings)
27 siblings, 0 replies; 32+ messages in thread
From: Isaku Yamahata @ 2010-01-05 6:27 UTC (permalink / raw)
To: qemu-devel, kraxel; +Cc: yamahata
Add argument, DeviceState*, to pci hot plug callback.
The argument will be used later to remove global variable.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
changes v10 -> v11:
- change callback argument from void* to DeviceState*.
---
hw/acpi_piix4.c | 6 +++---
hw/pci.c | 8 +++++---
hw/pci.h | 4 ++--
3 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/hw/acpi_piix4.c b/hw/acpi_piix4.c
index 6f26600..3dfa04a 100644
--- a/hw/acpi_piix4.c
+++ b/hw/acpi_piix4.c
@@ -562,7 +562,7 @@ static void pciej_write(void *opaque, uint32_t addr, uint32_t val)
#endif
}
-static int piix4_device_hotplug(PCIDevice *dev, int state);
+static int piix4_device_hotplug(DeviceState *qdev, PCIDevice *dev, int state);
void piix4_acpi_system_hot_add_init(PCIBus *bus)
{
@@ -575,7 +575,7 @@ void piix4_acpi_system_hot_add_init(PCIBus *bus)
register_ioport_write(PCI_EJ_BASE, 4, 4, pciej_write, bus);
register_ioport_read(PCI_EJ_BASE, 4, 4, pciej_read, bus);
- pci_bus_hotplug(bus, piix4_device_hotplug);
+ pci_bus_hotplug(bus, piix4_device_hotplug, NULL);
}
static void enable_device(struct pci_status *p, struct gpe_regs *g, int slot)
@@ -590,7 +590,7 @@ static void disable_device(struct pci_status *p, struct gpe_regs *g, int slot)
p->down |= (1 << slot);
}
-static int piix4_device_hotplug(PCIDevice *dev, int state)
+static int piix4_device_hotplug(DeviceState *qdev, PCIDevice *dev, int state)
{
int slot = PCI_SLOT(dev->devfn);
diff --git a/hw/pci.c b/hw/pci.c
index 0814383..7b6b02d 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -41,6 +41,7 @@ struct PCIBus {
pci_set_irq_fn set_irq;
pci_map_irq_fn map_irq;
pci_hotplug_fn hotplug;
+ DeviceState *hotplug_qdev;
uint32_t config_reg; /* XXX: suppress */
void *irq_opaque;
PCIDevice *devices[256];
@@ -232,10 +233,11 @@ void pci_bus_irqs(PCIBus *bus, pci_set_irq_fn set_irq, pci_map_irq_fn map_irq,
bus->irq_count = qemu_mallocz(nirq * sizeof(bus->irq_count[0]));
}
-void pci_bus_hotplug(PCIBus *bus, pci_hotplug_fn hotplug)
+void pci_bus_hotplug(PCIBus *bus, pci_hotplug_fn hotplug, DeviceState *qdev)
{
bus->qbus.allow_hotplug = 1;
bus->hotplug = hotplug;
+ bus->hotplug_qdev = qdev;
}
void pci_bus_set_mem_base(PCIBus *bus, target_phys_addr_t base)
@@ -1384,7 +1386,7 @@ static int pci_qdev_init(DeviceState *qdev, DeviceInfo *base)
pci_add_option_rom(pci_dev);
if (qdev->hotplugged)
- bus->hotplug(pci_dev, 1);
+ bus->hotplug(bus->hotplug_qdev, pci_dev, 1);
return 0;
}
@@ -1392,7 +1394,7 @@ static int pci_unplug_device(DeviceState *qdev)
{
PCIDevice *dev = DO_UPCAST(PCIDevice, qdev, qdev);
- dev->bus->hotplug(dev, 0);
+ dev->bus->hotplug(dev->bus->hotplug_qdev, dev, 0);
return 0;
}
diff --git a/hw/pci.h b/hw/pci.h
index fd16460..79b198a 100644
--- a/hw/pci.h
+++ b/hw/pci.h
@@ -273,13 +273,13 @@ int pci_device_load(PCIDevice *s, QEMUFile *f);
typedef void (*pci_set_irq_fn)(void *opaque, int irq_num, int level);
typedef int (*pci_map_irq_fn)(PCIDevice *pci_dev, int irq_num);
-typedef int (*pci_hotplug_fn)(PCIDevice *pci_dev, int state);
+typedef int (*pci_hotplug_fn)(DeviceState *qdev, PCIDevice *pci_dev, int state);
void pci_bus_new_inplace(PCIBus *bus, DeviceState *parent,
const char *name, int devfn_min);
PCIBus *pci_bus_new(DeviceState *parent, const char *name, int devfn_min);
void pci_bus_irqs(PCIBus *bus, pci_set_irq_fn set_irq, pci_map_irq_fn map_irq,
void *irq_opaque, int nirq);
-void pci_bus_hotplug(PCIBus *bus, pci_hotplug_fn hotplug);
+void pci_bus_hotplug(PCIBus *bus, pci_hotplug_fn hotplug, DeviceState *dev);
PCIBus *pci_register_bus(DeviceState *parent, const char *name,
pci_set_irq_fn set_irq, pci_map_irq_fn map_irq,
void *irq_opaque, int devfn_min, int nirq);
--
1.6.5.4
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [Qemu-devel] [PATCH V11 23/27] pci hotadd, acpi_piix4: remove global variables.
2010-01-05 6:27 [Qemu-devel] [PATCH V11 00/27] split out piix specific part from pc emulator and some clean ups Isaku Yamahata
` (21 preceding siblings ...)
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 22/27] pci hotplug: add argument to pci hot plug callback Isaku Yamahata
@ 2010-01-05 6:27 ` Isaku Yamahata
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 24/27] pc_smbus: remove #ifdef DEBUG Isaku Yamahata
` (4 subsequent siblings)
27 siblings, 0 replies; 32+ messages in thread
From: Isaku Yamahata @ 2010-01-05 6:27 UTC (permalink / raw)
To: qemu-devel, kraxel; +Cc: yamahata
remove global variables, gpe and pci0_status by moving them
into PIIX4PMState.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
Changes v10 -> v11:
- change callback argument of hotplug from void* to DeviceState*.
---
hw/acpi_piix4.c | 72 +++++++++++++++++++++++++++++-------------------------
hw/pc.h | 1 -
hw/pc_piix.c | 1 -
3 files changed, 39 insertions(+), 35 deletions(-)
diff --git a/hw/acpi_piix4.c b/hw/acpi_piix4.c
index 3dfa04a..e64a2dd 100644
--- a/hw/acpi_piix4.c
+++ b/hw/acpi_piix4.c
@@ -31,6 +31,20 @@
#define ACPI_DBG_IO_ADDR 0xb044
+#define GPE_BASE 0xafe0
+#define PCI_BASE 0xae00
+#define PCI_EJ_BASE 0xae08
+
+struct gpe_regs {
+ uint16_t sts; /* status */
+ uint16_t en; /* enabled */
+};
+
+struct pci_status {
+ uint32_t up;
+ uint32_t down;
+};
+
typedef struct PIIX4PMState {
PCIDevice dev;
uint16_t pmsts;
@@ -47,13 +61,17 @@ typedef struct PIIX4PMState {
qemu_irq irq;
qemu_irq cmos_s3_resume;
+
+ /* for pci hotplug */
+ struct gpe_regs gpe;
+ struct pci_status pci0_status;
} PIIX4PMState;
+static void piix4_acpi_system_hot_add_init(PCIBus *bus, PIIX4PMState *s);
+
#define ACPI_ENABLE 0xf1
#define ACPI_DISABLE 0xf0
-static PIIX4PMState *pm_state;
-
static uint32_t get_pmtmr(PIIX4PMState *s)
{
uint32_t d;
@@ -323,7 +341,6 @@ static int piix4_pm_initfn(PCIDevice *dev)
PIIX4PMState *s = DO_UPCAST(PIIX4PMState, dev, dev);
uint8_t *pci_conf;
- pm_state = s;
pci_conf = s->dev.config;
pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_INTEL);
pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_INTEL_82371AB_3);
@@ -384,6 +401,7 @@ i2c_bus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
s = DO_UPCAST(PIIX4PMState, dev, dev);
s->irq = sci_irq;
s->cmos_s3_resume = cmos_s3_resume;
+ piix4_acpi_system_hot_add_init(bus, s);
return s->smb.smbus;
}
@@ -408,23 +426,6 @@ static void piix4_pm_register(void)
device_init(piix4_pm_register);
-#define GPE_BASE 0xafe0
-#define PCI_BASE 0xae00
-#define PCI_EJ_BASE 0xae08
-
-struct gpe_regs {
- uint16_t sts; /* status */
- uint16_t en; /* enabled */
-};
-
-struct pci_status {
- uint32_t up;
- uint32_t down;
-};
-
-static struct gpe_regs gpe;
-static struct pci_status pci0_status;
-
static uint32_t gpe_read_val(uint16_t val, uint32_t addr)
{
if (addr & 1)
@@ -564,18 +565,21 @@ static void pciej_write(void *opaque, uint32_t addr, uint32_t val)
static int piix4_device_hotplug(DeviceState *qdev, PCIDevice *dev, int state);
-void piix4_acpi_system_hot_add_init(PCIBus *bus)
+static void piix4_acpi_system_hot_add_init(PCIBus *bus, PIIX4PMState *s)
{
- register_ioport_write(GPE_BASE, 4, 1, gpe_writeb, &gpe);
- register_ioport_read(GPE_BASE, 4, 1, gpe_readb, &gpe);
+ struct gpe_regs *gpe = &s->gpe;
+ struct pci_status *pci0_status = &s->pci0_status;
+
+ register_ioport_write(GPE_BASE, 4, 1, gpe_writeb, gpe);
+ register_ioport_read(GPE_BASE, 4, 1, gpe_readb, gpe);
- register_ioport_write(PCI_BASE, 8, 4, pcihotplug_write, &pci0_status);
- register_ioport_read(PCI_BASE, 8, 4, pcihotplug_read, &pci0_status);
+ register_ioport_write(PCI_BASE, 8, 4, pcihotplug_write, pci0_status);
+ register_ioport_read(PCI_BASE, 8, 4, pcihotplug_read, pci0_status);
register_ioport_write(PCI_EJ_BASE, 4, 4, pciej_write, bus);
register_ioport_read(PCI_EJ_BASE, 4, 4, pciej_read, bus);
- pci_bus_hotplug(bus, piix4_device_hotplug, NULL);
+ pci_bus_hotplug(bus, piix4_device_hotplug, &s->dev.qdev);
}
static void enable_device(struct pci_status *p, struct gpe_regs *g, int slot)
@@ -593,16 +597,18 @@ static void disable_device(struct pci_status *p, struct gpe_regs *g, int slot)
static int piix4_device_hotplug(DeviceState *qdev, PCIDevice *dev, int state)
{
int slot = PCI_SLOT(dev->devfn);
+ PIIX4PMState *s = DO_UPCAST(PIIX4PMState, dev,
+ DO_UPCAST(PCIDevice, qdev, qdev));
- pci0_status.up = 0;
- pci0_status.down = 0;
+ s->pci0_status.up = 0;
+ s->pci0_status.down = 0;
if (state)
- enable_device(&pci0_status, &gpe, slot);
+ enable_device(&s->pci0_status, &s->gpe, slot);
else
- disable_device(&pci0_status, &gpe, slot);
- if (gpe.en & 2) {
- qemu_set_irq(pm_state->irq, 1);
- qemu_set_irq(pm_state->irq, 0);
+ disable_device(&s->pci0_status, &s->gpe, slot);
+ if (s->gpe.en & 2) {
+ qemu_set_irq(s->irq, 1);
+ qemu_set_irq(s->irq, 0);
}
return 0;
}
diff --git a/hw/pc.h b/hw/pc.h
index 2088cfd..e27ea97 100644
--- a/hw/pc.h
+++ b/hw/pc.h
@@ -141,7 +141,6 @@ int acpi_table_add(const char *table_desc);
i2c_bus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
qemu_irq sci_irq, qemu_irq cmos_set_s3_resume);
void piix4_smbus_register_device(SMBusDevice *dev, uint8_t addr);
-void piix4_acpi_system_hot_add_init(PCIBus *bus);
/* hpet.c */
extern int no_hpet;
diff --git a/hw/pc_piix.c b/hw/pc_piix.c
index 682b64c..fbe9857 100644
--- a/hw/pc_piix.c
+++ b/hw/pc_piix.c
@@ -158,7 +158,6 @@ static void pc_init1(ram_addr_t ram_size,
qdev_prop_set_ptr(eeprom, "data", eeprom_buf + (i * 256));
qdev_init_nofail(eeprom);
}
- piix4_acpi_system_hot_add_init(pci_bus);
}
if (i440fx_state) {
--
1.6.5.4
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [Qemu-devel] [PATCH V11 24/27] pc_smbus: remove #ifdef DEBUG.
2010-01-05 6:27 [Qemu-devel] [PATCH V11 00/27] split out piix specific part from pc emulator and some clean ups Isaku Yamahata
` (22 preceding siblings ...)
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 23/27] pci hotadd, acpi_piix4: remove global variables Isaku Yamahata
@ 2010-01-05 6:27 ` Isaku Yamahata
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 25/27] acpi_piix4: " Isaku Yamahata
` (3 subsequent siblings)
27 siblings, 0 replies; 32+ messages in thread
From: Isaku Yamahata @ 2010-01-05 6:27 UTC (permalink / raw)
To: qemu-devel, kraxel; +Cc: yamahata
remove #ifdef DEBUG by using macro.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
hw/pc_smbus.c | 21 ++++++++++++---------
1 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/hw/pc_smbus.c b/hw/pc_smbus.c
index 30cdaa7..1d44d1e 100644
--- a/hw/pc_smbus.c
+++ b/hw/pc_smbus.c
@@ -37,6 +37,15 @@
#define SMBHSTDAT1 0x06
#define SMBBLKDAT 0x07
+//#define DEBUG
+
+#ifdef DEBUG
+# define SMBUS_DPRINTF(format, ...) printf(format, ## __VA_ARGS__)
+#else
+# define SMBUS_DPRINTF(format, ...) do { } while (0)
+#endif
+
+
static void smb_transaction(PCSMBus *s)
{
uint8_t prot = (s->smb_ctl >> 2) & 0x07;
@@ -45,9 +54,7 @@ static void smb_transaction(PCSMBus *s)
uint8_t addr = s->smb_addr >> 1;
i2c_bus *bus = s->smbus;
-#ifdef DEBUG
- printf("SMBus trans addr=0x%02x prot=0x%02x\n", addr, prot);
-#endif
+ SMBUS_DPRINTF("SMBus trans addr=0x%02x prot=0x%02x\n", addr, prot);
switch(prot) {
case 0x0:
smbus_quick_command(bus, addr, read);
@@ -96,9 +103,7 @@ void smb_ioport_writeb(void *opaque, uint32_t addr, uint32_t val)
{
PCSMBus *s = opaque;
addr &= 0x3f;
-#ifdef DEBUG
- printf("SMB writeb port=0x%04x val=0x%02x\n", addr, val);
-#endif
+ SMBUS_DPRINTF("SMB writeb port=0x%04x val=0x%02x\n", addr, val);
switch(addr) {
case SMBHSTSTS:
s->smb_stat = 0;
@@ -166,9 +171,7 @@ uint32_t smb_ioport_readb(void *opaque, uint32_t addr)
val = 0;
break;
}
-#ifdef DEBUG
- printf("SMB readb port=0x%04x val=0x%02x\n", addr, val);
-#endif
+ SMBUS_DPRINTF("SMB readb port=0x%04x val=0x%02x\n", addr, val);
return val;
}
--
1.6.5.4
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [Qemu-devel] [PATCH V11 25/27] acpi_piix4: remove #ifdef DEBUG.
2010-01-05 6:27 [Qemu-devel] [PATCH V11 00/27] split out piix specific part from pc emulator and some clean ups Isaku Yamahata
` (23 preceding siblings ...)
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 24/27] pc_smbus: remove #ifdef DEBUG Isaku Yamahata
@ 2010-01-05 6:27 ` Isaku Yamahata
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 26/27] pc_apm: " Isaku Yamahata
` (2 subsequent siblings)
27 siblings, 0 replies; 32+ messages in thread
From: Isaku Yamahata @ 2010-01-05 6:27 UTC (permalink / raw)
To: qemu-devel, kraxel; +Cc: yamahata
removed #ifdef DEBUG by using macro.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
hw/acpi_piix4.c | 54 ++++++++++++++++++------------------------------------
1 files changed, 18 insertions(+), 36 deletions(-)
diff --git a/hw/acpi_piix4.c b/hw/acpi_piix4.c
index e64a2dd..2540626 100644
--- a/hw/acpi_piix4.c
+++ b/hw/acpi_piix4.c
@@ -29,6 +29,12 @@
//#define DEBUG
+#ifdef DEBUG
+# define PIIX4_DPRINTF(format, ...) printf(format, ## __VA_ARGS__)
+#else
+# define PIIX4_DPRINTF(format, ...) do { } while (0)
+#endif
+
#define ACPI_DBG_IO_ADDR 0xb044
#define GPE_BASE 0xafe0
@@ -170,9 +176,7 @@ static void pm_ioport_writew(void *opaque, uint32_t addr, uint32_t val)
default:
break;
}
-#ifdef DEBUG
- printf("PM writew port=0x%04x val=0x%04x\n", addr, val);
-#endif
+ PIIX4_DPRINTF("PM writew port=0x%04x val=0x%04x\n", addr, val);
}
static uint32_t pm_ioport_readw(void *opaque, uint32_t addr)
@@ -195,9 +199,7 @@ static uint32_t pm_ioport_readw(void *opaque, uint32_t addr)
val = 0;
break;
}
-#ifdef DEBUG
- printf("PM readw port=0x%04x val=0x%04x\n", addr, val);
-#endif
+ PIIX4_DPRINTF("PM readw port=0x%04x val=0x%04x\n", addr, val);
return val;
}
@@ -205,9 +207,7 @@ static void pm_ioport_writel(void *opaque, uint32_t addr, uint32_t val)
{
// PIIX4PMState *s = opaque;
addr &= 0x3f;
-#ifdef DEBUG
- printf("PM writel port=0x%04x val=0x%08x\n", addr, val);
-#endif
+ PIIX4_DPRINTF("PM writel port=0x%04x val=0x%08x\n", addr, val);
}
static uint32_t pm_ioport_readl(void *opaque, uint32_t addr)
@@ -224,9 +224,7 @@ static uint32_t pm_ioport_readl(void *opaque, uint32_t addr)
val = 0;
break;
}
-#ifdef DEBUG
- printf("PM readl port=0x%04x val=0x%08x\n", addr, val);
-#endif
+ PIIX4_DPRINTF("PM readl port=0x%04x val=0x%08x\n", addr, val);
return val;
}
@@ -248,9 +246,7 @@ static void apm_ctrl_changed(uint32_t val, void *arg)
static void acpi_dbg_writel(void *opaque, uint32_t addr, uint32_t val)
{
-#if defined(DEBUG)
- printf("ACPI: DBG: 0x%08x\n", val);
-#endif
+ PIIX4_DPRINTF("ACPI: DBG: 0x%08x\n", val);
}
static void pm_io_space_update(PIIX4PMState *s)
@@ -262,9 +258,7 @@ static void pm_io_space_update(PIIX4PMState *s)
pm_io_base &= 0xffc0;
/* XXX: need to improve memory and ioport allocation */
-#if defined(DEBUG)
- printf("PM: mapping to 0x%x\n", pm_io_base);
-#endif
+ PIIX4_DPRINTF("PM: mapping to 0x%x\n", pm_io_base);
register_ioport_write(pm_io_base, 64, 2, pm_ioport_writew, s);
register_ioport_read(pm_io_base, 64, 2, pm_ioport_readw, s);
register_ioport_write(pm_io_base, 64, 4, pm_ioport_writel, s);
@@ -450,9 +444,7 @@ static uint32_t gpe_readb(void *opaque, uint32_t addr)
break;
}
-#if defined(DEBUG)
- printf("gpe read %x == %x\n", addr, val);
-#endif
+ PIIX4_DPRINTF("gpe read %x == %x\n", addr, val);
return val;
}
@@ -492,9 +484,7 @@ static void gpe_writeb(void *opaque, uint32_t addr, uint32_t val)
break;
}
-#if defined(DEBUG)
- printf("gpe write %x <== %d\n", addr, val);
-#endif
+ PIIX4_DPRINTF("gpe write %x <== %d\n", addr, val);
}
static uint32_t pcihotplug_read(void *opaque, uint32_t addr)
@@ -512,9 +502,7 @@ static uint32_t pcihotplug_read(void *opaque, uint32_t addr)
break;
}
-#if defined(DEBUG)
- printf("pcihotplug read %x == %x\n", addr, val);
-#endif
+ PIIX4_DPRINTF("pcihotplug read %x == %x\n", addr, val);
return val;
}
@@ -530,16 +518,12 @@ static void pcihotplug_write(void *opaque, uint32_t addr, uint32_t val)
break;
}
-#if defined(DEBUG)
- printf("pcihotplug write %x <== %d\n", addr, val);
-#endif
+ PIIX4_DPRINTF("pcihotplug write %x <== %d\n", addr, val);
}
static uint32_t pciej_read(void *opaque, uint32_t addr)
{
-#if defined(DEBUG)
- printf("pciej read %x\n", addr);
-#endif
+ PIIX4_DPRINTF("pciej read %x\n", addr);
return 0;
}
@@ -558,9 +542,7 @@ static void pciej_write(void *opaque, uint32_t addr, uint32_t val)
}
-#if defined(DEBUG)
- printf("pciej write %x <== %d\n", addr, val);
-#endif
+ PIIX4_DPRINTF("pciej write %x <== %d\n", addr, val);
}
static int piix4_device_hotplug(DeviceState *qdev, PCIDevice *dev, int state);
--
1.6.5.4
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [Qemu-devel] [PATCH V11 26/27] pc_apm: remove #ifdef DEBUG.
2010-01-05 6:27 [Qemu-devel] [PATCH V11 00/27] split out piix specific part from pc emulator and some clean ups Isaku Yamahata
` (24 preceding siblings ...)
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 25/27] acpi_piix4: " Isaku Yamahata
@ 2010-01-05 6:27 ` Isaku Yamahata
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 27/27] mc146818rtc: remove #ifdef DEBUG_CMOS Isaku Yamahata
2010-01-05 9:45 ` [Qemu-devel] Re: [PATCH V11 00/27] split out piix specific part from pc emulator and some clean ups Gerd Hoffmann
27 siblings, 0 replies; 32+ messages in thread
From: Isaku Yamahata @ 2010-01-05 6:27 UTC (permalink / raw)
To: qemu-devel, kraxel; +Cc: yamahata
remove #ifdef DEBUG by using macro.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
hw/pc_apm.c | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/hw/pc_apm.c b/hw/pc_apm.c
index f6bcd7d..e1cee96 100644
--- a/hw/pc_apm.c
+++ b/hw/pc_apm.c
@@ -23,6 +23,12 @@
//#define DEBUG
+#ifdef DEBUG
+# define APM_DPRINTF(format, ...) printf(format, ## __VA_ARGS__)
+#else
+# define APM_DPRINTF(format, ...) do { } while (0)
+#endif
+
/* fixed I/O location */
#define APM_CNT_IOPORT 0xb2
#define APM_STS_IOPORT 0xb3
@@ -31,9 +37,7 @@ static void apm_ioport_writeb(void *opaque, uint32_t addr, uint32_t val)
{
APMState *apm = opaque;
addr &= 1;
-#ifdef DEBUG
- printf("apm_ioport_writeb addr=0x%x val=0x%02x\n", addr, val);
-#endif
+ APM_DPRINTF("apm_ioport_writeb addr=0x%x val=0x%02x\n", addr, val);
if (addr == 0) {
apm->apmc = val;
@@ -56,9 +60,7 @@ static uint32_t apm_ioport_readb(void *opaque, uint32_t addr)
} else {
val = apm->apms;
}
-#ifdef DEBUG
- printf("apm_ioport_readb addr=0x%x val=0x%02x\n", addr, val);
-#endif
+ APM_DPRINTF("apm_ioport_readb addr=0x%x val=0x%02x\n", addr, val);
return val;
}
--
1.6.5.4
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [Qemu-devel] [PATCH V11 27/27] mc146818rtc: remove #ifdef DEBUG_CMOS.
2010-01-05 6:27 [Qemu-devel] [PATCH V11 00/27] split out piix specific part from pc emulator and some clean ups Isaku Yamahata
` (25 preceding siblings ...)
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 26/27] pc_apm: " Isaku Yamahata
@ 2010-01-05 6:27 ` Isaku Yamahata
2010-01-05 9:45 ` [Qemu-devel] Re: [PATCH V11 00/27] split out piix specific part from pc emulator and some clean ups Gerd Hoffmann
27 siblings, 0 replies; 32+ messages in thread
From: Isaku Yamahata @ 2010-01-05 6:27 UTC (permalink / raw)
To: qemu-devel, kraxel; +Cc: yamahata
remove #ifdef DEBUG_CMOS by using macro.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
hw/mc146818rtc.c | 18 ++++++++++--------
1 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/hw/mc146818rtc.c b/hw/mc146818rtc.c
index 1eb991c..0e1dc07 100644
--- a/hw/mc146818rtc.c
+++ b/hw/mc146818rtc.c
@@ -31,6 +31,12 @@
//#define DEBUG_CMOS
+#ifdef DEBUG_CMOS
+# define CMOS_DPRINTF(format, ...) printf(format, ## __VA_ARGS__)
+#else
+# define CMOS_DPRINTF(format, ...) do { } while (0)
+#endif
+
#define RTC_REINJECT_ON_ACK_COUNT 1000
#define RTC_SECONDS 0
@@ -210,10 +216,8 @@ static void cmos_ioport_write(void *opaque, uint32_t addr, uint32_t data)
if ((addr & 1) == 0) {
s->cmos_index = data & 0x7f;
} else {
-#ifdef DEBUG_CMOS
- printf("cmos: write index=0x%02x val=0x%02x\n",
- s->cmos_index, data);
-#endif
+ CMOS_DPRINTF("cmos: write index=0x%02x val=0x%02x\n",
+ s->cmos_index, data);
switch(s->cmos_index) {
case RTC_SECONDS_ALARM:
case RTC_MINUTES_ALARM:
@@ -482,10 +486,8 @@ static uint32_t cmos_ioport_read(void *opaque, uint32_t addr)
ret = s->cmos_data[s->cmos_index];
break;
}
-#ifdef DEBUG_CMOS
- printf("cmos: read index=0x%02x val=0x%02x\n",
- s->cmos_index, ret);
-#endif
+ CMOS_DPRINTF("cmos: read index=0x%02x val=0x%02x\n",
+ s->cmos_index, ret);
return ret;
}
}
--
1.6.5.4
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [Qemu-devel] Re: [PATCH V11 00/27] split out piix specific part from pc emulator and some clean ups
2010-01-05 6:27 [Qemu-devel] [PATCH V11 00/27] split out piix specific part from pc emulator and some clean ups Isaku Yamahata
` (26 preceding siblings ...)
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 27/27] mc146818rtc: remove #ifdef DEBUG_CMOS Isaku Yamahata
@ 2010-01-05 9:45 ` Gerd Hoffmann
27 siblings, 0 replies; 32+ messages in thread
From: Gerd Hoffmann @ 2010-01-05 9:45 UTC (permalink / raw)
To: Isaku Yamahata; +Cc: qemu-devel
On 01/05/10 07:27, Isaku Yamahata wrote:
> Now I addressed the minor nits Gerd pointed out,
> so now they are ready to commit, I think.
whole series:
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
cheers,
Gerd
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [Qemu-devel] [PATCH V11 01/27] acpi: split out pc smbus routines from acpi.c into pc_smbus.c
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 01/27] acpi: split out pc smbus routines from acpi.c into pc_smbus.c Isaku Yamahata
@ 2010-01-05 22:11 ` Aurelien Jarno
2010-01-06 1:24 ` Isaku Yamahata
0 siblings, 1 reply; 32+ messages in thread
From: Aurelien Jarno @ 2010-01-05 22:11 UTC (permalink / raw)
To: Isaku Yamahata; +Cc: qemu-devel, kraxel
On Tue, Jan 05, 2010 at 03:27:24PM +0900, Isaku Yamahata wrote:
> Split out pc smbus routines from acpi.c into pc_smbus.c and
> use it.
Given the code is not specific to PC, but is also used on MIPS, I am not
sure pc_smbus is the best name.
> The split out smbus emulation will be used later.
>
> Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
>
> ---
> changes v10 -> v11
> - add DeviceState *qdev argument to pc_smbus_init()
> for info qtree.
> ---
> Makefile.target | 2 +
> hw/acpi.c | 164 +++------------------------------------------------
> hw/pc_smbus.c | 178 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
> hw/pc_smbus.h | 21 +++++++
> 4 files changed, 209 insertions(+), 156 deletions(-)
> create mode 100644 hw/pc_smbus.c
> create mode 100644 hw/pc_smbus.h
>
> diff --git a/Makefile.target b/Makefile.target
> index 7c1f30c..2cde15f 100644
> --- a/Makefile.target
> +++ b/Makefile.target
> @@ -195,6 +195,7 @@ obj-i386-y += cirrus_vga.o apic.o ioapic.o parallel.o acpi.o piix_pci.o
> obj-i386-y += usb-uhci.o vmmouse.o vmport.o vmware_vga.o hpet.o
> obj-i386-y += device-hotplug.o pci-hotplug.o smbios.o wdt_ib700.o
> obj-i386-y += ne2000-isa.o
> +obj-i386-y += pc_smbus.o
>
> # shared objects
> obj-ppc-y = ppc.o ide/core.o ide/qdev.o ide/isa.o ide/pci.o ide/macio.o
> @@ -225,6 +226,7 @@ obj-mips-y += ide/core.o ide/qdev.o ide/isa.o ide/pci.o ide/piix.o
> obj-mips-y += gt64xxx.o pckbd.o fdc.o mc146818rtc.o usb-uhci.o acpi.o ds1225y.o
> obj-mips-y += piix4.o parallel.o cirrus_vga.o pcspk.o $(sound-obj-y)
> obj-mips-y += mipsnet.o ne2000-isa.o
> +obj-mips-y += pc_smbus.o
> obj-mips-y += pflash_cfi01.o
> obj-mips-y += vmware_vga.o
>
> diff --git a/hw/acpi.c b/hw/acpi.c
> index 9a69e7d..507b308 100644
> --- a/hw/acpi.c
> +++ b/hw/acpi.c
> @@ -17,6 +17,7 @@
> */
> #include "hw.h"
> #include "pc.h"
> +#include "pc_smbus.h"
> #include "pci.h"
> #include "qemu-timer.h"
> #include "sysemu.h"
> @@ -40,15 +41,9 @@ typedef struct PIIX4PMState {
> uint8_t apms;
> QEMUTimer *tmr_timer;
> int64_t tmr_overflow_time;
> - i2c_bus *smbus;
> - uint8_t smb_stat;
> - uint8_t smb_ctl;
> - uint8_t smb_cmd;
> - uint8_t smb_addr;
> - uint8_t smb_data0;
> - uint8_t smb_data1;
> - uint8_t smb_data[32];
> - uint8_t smb_index;
> +
> + PCSMBus smb;
> +
> qemu_irq irq;
> } PIIX4PMState;
>
> @@ -66,14 +61,6 @@ typedef struct PIIX4PMState {
> #define ACPI_ENABLE 0xf1
> #define ACPI_DISABLE 0xf0
>
> -#define SMBHSTSTS 0x00
> -#define SMBHSTCNT 0x02
> -#define SMBHSTCMD 0x03
> -#define SMBHSTADD 0x04
> -#define SMBHSTDAT0 0x05
> -#define SMBHSTDAT1 0x06
> -#define SMBBLKDAT 0x07
> -
> static PIIX4PMState *pm_state;
>
> static uint32_t get_pmtmr(PIIX4PMState *s)
> @@ -279,141 +266,6 @@ static void acpi_dbg_writel(void *opaque, uint32_t addr, uint32_t val)
> #endif
> }
>
> -static void smb_transaction(PIIX4PMState *s)
> -{
> - uint8_t prot = (s->smb_ctl >> 2) & 0x07;
> - uint8_t read = s->smb_addr & 0x01;
> - uint8_t cmd = s->smb_cmd;
> - uint8_t addr = s->smb_addr >> 1;
> - i2c_bus *bus = s->smbus;
> -
> -#ifdef DEBUG
> - printf("SMBus trans addr=0x%02x prot=0x%02x\n", addr, prot);
> -#endif
> - switch(prot) {
> - case 0x0:
> - smbus_quick_command(bus, addr, read);
> - break;
> - case 0x1:
> - if (read) {
> - s->smb_data0 = smbus_receive_byte(bus, addr);
> - } else {
> - smbus_send_byte(bus, addr, cmd);
> - }
> - break;
> - case 0x2:
> - if (read) {
> - s->smb_data0 = smbus_read_byte(bus, addr, cmd);
> - } else {
> - smbus_write_byte(bus, addr, cmd, s->smb_data0);
> - }
> - break;
> - case 0x3:
> - if (read) {
> - uint16_t val;
> - val = smbus_read_word(bus, addr, cmd);
> - s->smb_data0 = val;
> - s->smb_data1 = val >> 8;
> - } else {
> - smbus_write_word(bus, addr, cmd, (s->smb_data1 << 8) | s->smb_data0);
> - }
> - break;
> - case 0x5:
> - if (read) {
> - s->smb_data0 = smbus_read_block(bus, addr, cmd, s->smb_data);
> - } else {
> - smbus_write_block(bus, addr, cmd, s->smb_data, s->smb_data0);
> - }
> - break;
> - default:
> - goto error;
> - }
> - return;
> -
> - error:
> - s->smb_stat |= 0x04;
> -}
> -
> -static void smb_ioport_writeb(void *opaque, uint32_t addr, uint32_t val)
> -{
> - PIIX4PMState *s = opaque;
> - addr &= 0x3f;
> -#ifdef DEBUG
> - printf("SMB writeb port=0x%04x val=0x%02x\n", addr, val);
> -#endif
> - switch(addr) {
> - case SMBHSTSTS:
> - s->smb_stat = 0;
> - s->smb_index = 0;
> - break;
> - case SMBHSTCNT:
> - s->smb_ctl = val;
> - if (val & 0x40)
> - smb_transaction(s);
> - break;
> - case SMBHSTCMD:
> - s->smb_cmd = val;
> - break;
> - case SMBHSTADD:
> - s->smb_addr = val;
> - break;
> - case SMBHSTDAT0:
> - s->smb_data0 = val;
> - break;
> - case SMBHSTDAT1:
> - s->smb_data1 = val;
> - break;
> - case SMBBLKDAT:
> - s->smb_data[s->smb_index++] = val;
> - if (s->smb_index > 31)
> - s->smb_index = 0;
> - break;
> - default:
> - break;
> - }
> -}
> -
> -static uint32_t smb_ioport_readb(void *opaque, uint32_t addr)
> -{
> - PIIX4PMState *s = opaque;
> - uint32_t val;
> -
> - addr &= 0x3f;
> - switch(addr) {
> - case SMBHSTSTS:
> - val = s->smb_stat;
> - break;
> - case SMBHSTCNT:
> - s->smb_index = 0;
> - val = s->smb_ctl & 0x1f;
> - break;
> - case SMBHSTCMD:
> - val = s->smb_cmd;
> - break;
> - case SMBHSTADD:
> - val = s->smb_addr;
> - break;
> - case SMBHSTDAT0:
> - val = s->smb_data0;
> - break;
> - case SMBHSTDAT1:
> - val = s->smb_data1;
> - break;
> - case SMBBLKDAT:
> - val = s->smb_data[s->smb_index++];
> - if (s->smb_index > 31)
> - s->smb_index = 0;
> - break;
> - default:
> - val = 0;
> - break;
> - }
> -#ifdef DEBUG
> - printf("SMB readb port=0x%04x val=0x%02x\n", addr, val);
> -#endif
> - return val;
> -}
> -
> static void pm_io_space_update(PIIX4PMState *s)
> {
> uint32_t pm_io_base;
> @@ -542,8 +394,8 @@ i2c_bus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
> pci_conf[0x90] = smb_io_base | 1;
> pci_conf[0x91] = smb_io_base >> 8;
> pci_conf[0xd2] = 0x09;
> - register_ioport_write(smb_io_base, 64, 1, smb_ioport_writeb, s);
> - register_ioport_read(smb_io_base, 64, 1, smb_ioport_readb, s);
> + register_ioport_write(smb_io_base, 64, 1, smb_ioport_writeb, &s->smb);
> + register_ioport_read(smb_io_base, 64, 1, smb_ioport_readb, &s->smb);
>
> s->tmr_timer = qemu_new_timer(vm_clock, pm_tmr_timer, s);
>
> @@ -551,11 +403,11 @@ i2c_bus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
>
> vmstate_register(0, &vmstate_acpi, s);
>
> - s->smbus = i2c_init_bus(NULL, "i2c");
> + pc_smbus_init(NULL, &s->smb);
> s->irq = sci_irq;
> qemu_register_reset(piix4_reset, s);
>
> - return s->smbus;
> + return s->smb.smbus;
> }
>
> #define GPE_BASE 0xafe0
> diff --git a/hw/pc_smbus.c b/hw/pc_smbus.c
> new file mode 100644
> index 0000000..30cdaa7
> --- /dev/null
> +++ b/hw/pc_smbus.c
> @@ -0,0 +1,178 @@
> +/*
> + * PC SMBus implementation
> + * splitted from acpi.c
> + *
> + * Copyright (c) 2006 Fabrice Bellard
> + *
> + * This library is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License version 2 as published by the Free Software Foundation.
> + *
> + * This library is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this library; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA
> + */
> +#include "hw.h"
> +#include "pc.h"
> +#include "pc_smbus.h"
> +#include "pci.h"
> +#include "qemu-timer.h"
> +#include "sysemu.h"
> +#include "i2c.h"
> +#include "smbus.h"
> +#include "kvm.h"
Do we really need kvm.h here?
> +
> +/* no save/load? */
> +
> +#define SMBHSTSTS 0x00
> +#define SMBHSTCNT 0x02
> +#define SMBHSTCMD 0x03
> +#define SMBHSTADD 0x04
> +#define SMBHSTDAT0 0x05
> +#define SMBHSTDAT1 0x06
> +#define SMBBLKDAT 0x07
> +
> +static void smb_transaction(PCSMBus *s)
> +{
> + uint8_t prot = (s->smb_ctl >> 2) & 0x07;
> + uint8_t read = s->smb_addr & 0x01;
> + uint8_t cmd = s->smb_cmd;
> + uint8_t addr = s->smb_addr >> 1;
> + i2c_bus *bus = s->smbus;
> +
> +#ifdef DEBUG
> + printf("SMBus trans addr=0x%02x prot=0x%02x\n", addr, prot);
> +#endif
> + switch(prot) {
> + case 0x0:
> + smbus_quick_command(bus, addr, read);
> + break;
> + case 0x1:
> + if (read) {
> + s->smb_data0 = smbus_receive_byte(bus, addr);
> + } else {
> + smbus_send_byte(bus, addr, cmd);
> + }
> + break;
> + case 0x2:
> + if (read) {
> + s->smb_data0 = smbus_read_byte(bus, addr, cmd);
> + } else {
> + smbus_write_byte(bus, addr, cmd, s->smb_data0);
> + }
> + break;
> + case 0x3:
> + if (read) {
> + uint16_t val;
> + val = smbus_read_word(bus, addr, cmd);
> + s->smb_data0 = val;
> + s->smb_data1 = val >> 8;
> + } else {
> + smbus_write_word(bus, addr, cmd, (s->smb_data1 << 8) | s->smb_data0);
> + }
> + break;
> + case 0x5:
> + if (read) {
> + s->smb_data0 = smbus_read_block(bus, addr, cmd, s->smb_data);
> + } else {
> + smbus_write_block(bus, addr, cmd, s->smb_data, s->smb_data0);
> + }
> + break;
> + default:
> + goto error;
> + }
> + return;
> +
> + error:
> + s->smb_stat |= 0x04;
> +}
> +
> +void smb_ioport_writeb(void *opaque, uint32_t addr, uint32_t val)
> +{
> + PCSMBus *s = opaque;
> + addr &= 0x3f;
> +#ifdef DEBUG
> + printf("SMB writeb port=0x%04x val=0x%02x\n", addr, val);
> +#endif
> + switch(addr) {
> + case SMBHSTSTS:
> + s->smb_stat = 0;
> + s->smb_index = 0;
> + break;
> + case SMBHSTCNT:
> + s->smb_ctl = val;
> + if (val & 0x40)
> + smb_transaction(s);
> + break;
> + case SMBHSTCMD:
> + s->smb_cmd = val;
> + break;
> + case SMBHSTADD:
> + s->smb_addr = val;
> + break;
> + case SMBHSTDAT0:
> + s->smb_data0 = val;
> + break;
> + case SMBHSTDAT1:
> + s->smb_data1 = val;
> + break;
> + case SMBBLKDAT:
> + s->smb_data[s->smb_index++] = val;
> + if (s->smb_index > 31)
> + s->smb_index = 0;
> + break;
> + default:
> + break;
> + }
> +}
> +
> +uint32_t smb_ioport_readb(void *opaque, uint32_t addr)
> +{
> + PCSMBus *s = opaque;
> + uint32_t val;
> +
> + addr &= 0x3f;
> + switch(addr) {
> + case SMBHSTSTS:
> + val = s->smb_stat;
> + break;
> + case SMBHSTCNT:
> + s->smb_index = 0;
> + val = s->smb_ctl & 0x1f;
> + break;
> + case SMBHSTCMD:
> + val = s->smb_cmd;
> + break;
> + case SMBHSTADD:
> + val = s->smb_addr;
> + break;
> + case SMBHSTDAT0:
> + val = s->smb_data0;
> + break;
> + case SMBHSTDAT1:
> + val = s->smb_data1;
> + break;
> + case SMBBLKDAT:
> + val = s->smb_data[s->smb_index++];
> + if (s->smb_index > 31)
> + s->smb_index = 0;
> + break;
> + default:
> + val = 0;
> + break;
> + }
> +#ifdef DEBUG
> + printf("SMB readb port=0x%04x val=0x%02x\n", addr, val);
> +#endif
> + return val;
> +}
> +
> +void pc_smbus_init(DeviceState *parent, PCSMBus *smb)
> +{
> + smb->smbus = i2c_init_bus(parent, "i2c");
> +}
> diff --git a/hw/pc_smbus.h b/hw/pc_smbus.h
> new file mode 100644
> index 0000000..27c0eec
> --- /dev/null
> +++ b/hw/pc_smbus.h
> @@ -0,0 +1,21 @@
> +#ifndef PC_SMBUS_H
> +#define PC_SMBUS_H
> +
> +typedef struct PCSMBus {
> + i2c_bus *smbus;
> +
> + uint8_t smb_stat;
> + uint8_t smb_ctl;
> + uint8_t smb_cmd;
> + uint8_t smb_addr;
> + uint8_t smb_data0;
> + uint8_t smb_data1;
> + uint8_t smb_data[32];
> + uint8_t smb_index;
> +} PCSMBus;
> +
> +void pc_smbus_init(DeviceState *parent, PCSMBus *smb);
> +void smb_ioport_writeb(void *opaque, uint32_t addr, uint32_t val);
> +uint32_t smb_ioport_readb(void *opaque, uint32_t addr);
> +
> +#endif /* !PC_SMBUS_H */
> --
> 1.6.5.4
>
>
>
>
--
Aurelien Jarno GPG: 1024D/F1BCDB73
aurelien@aurel32.net http://www.aurel32.net
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [Qemu-devel] [PATCH V11 01/27] acpi: split out pc smbus routines from acpi.c into pc_smbus.c
2010-01-05 22:11 ` Aurelien Jarno
@ 2010-01-06 1:24 ` Isaku Yamahata
2010-01-06 7:26 ` Aurelien Jarno
0 siblings, 1 reply; 32+ messages in thread
From: Isaku Yamahata @ 2010-01-06 1:24 UTC (permalink / raw)
To: Aurelien Jarno; +Cc: qemu-devel, kraxel
On Tue, Jan 05, 2010 at 11:11:00PM +0100, Aurelien Jarno wrote:
> On Tue, Jan 05, 2010 at 03:27:24PM +0900, Isaku Yamahata wrote:
> > Split out pc smbus routines from acpi.c into pc_smbus.c and
> > use it.
>
> Given the code is not specific to PC, but is also used on MIPS, I am not
> sure pc_smbus is the best name.
Okay. I'll drop pc_ prefix. (for both file name and function names).
Do you also want similar to pc_apm.c in the next patch?
--
yamahata
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [Qemu-devel] [PATCH V11 01/27] acpi: split out pc smbus routines from acpi.c into pc_smbus.c
2010-01-06 1:24 ` Isaku Yamahata
@ 2010-01-06 7:26 ` Aurelien Jarno
0 siblings, 0 replies; 32+ messages in thread
From: Aurelien Jarno @ 2010-01-06 7:26 UTC (permalink / raw)
To: Isaku Yamahata; +Cc: qemu-devel, kraxel
Isaku Yamahata a écrit :
> On Tue, Jan 05, 2010 at 11:11:00PM +0100, Aurelien Jarno wrote:
>> On Tue, Jan 05, 2010 at 03:27:24PM +0900, Isaku Yamahata wrote:
>>> Split out pc smbus routines from acpi.c into pc_smbus.c and
>>> use it.
>> Given the code is not specific to PC, but is also used on MIPS, I am not
>> sure pc_smbus is the best name.
>
> Okay. I'll drop pc_ prefix. (for both file name and function names).
> Do you also want similar to pc_apm.c in the next patch?
>
Yes, it looks better to me.
--
Aurelien Jarno GPG: 1024D/F1BCDB73
aurelien@aurel32.net http://www.aurel32.net
^ permalink raw reply [flat|nested] 32+ messages in thread
end of thread, other threads:[~2010-01-06 7:26 UTC | newest]
Thread overview: 32+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-05 6:27 [Qemu-devel] [PATCH V11 00/27] split out piix specific part from pc emulator and some clean ups Isaku Yamahata
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 01/27] acpi: split out pc smbus routines from acpi.c into pc_smbus.c Isaku Yamahata
2010-01-05 22:11 ` Aurelien Jarno
2010-01-06 1:24 ` Isaku Yamahata
2010-01-06 7:26 ` Aurelien Jarno
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 02/27] acpi: split out apm register emulation from acpi.c Isaku Yamahata
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 03/27] acpi: add acpi constants from linux header files and use them Isaku Yamahata
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 04/27] acpi: split acpi.c into the common part and the piix4 part Isaku Yamahata
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 05/27] acpi_piix4: remove unused variable in get_pmsts() Isaku Yamahata
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 06/27] pc: initialize ioapic before use Isaku Yamahata
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 07/27] pc, i440fx: Make smm enable/disable function i440fx independent Isaku Yamahata
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 08/27] pc: make an unnecessary global variable, pit, local Isaku Yamahata
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 09/27] pc: remove a global variable, floppy_controller Isaku Yamahata
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 10/27] pc: remove global variable rtc_state by using qemu_irq Isaku Yamahata
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 11/27] pc: introduce a function to allocate cpu irq Isaku Yamahata
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 12/27] pc: make pc_init1() not refer ferr_irq directly Isaku Yamahata
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 13/27] pc: split out cpu initialization from pc_init1() into pc_cpus_init() Isaku Yamahata
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 14/27] pc: split out memory allocation from pc_init1() into pc_memory_init() Isaku Yamahata
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 15/27] pc: split out vga initialization from pc_init1() into pc_vga_init() Isaku Yamahata
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 16/27] pc: split out basic device init from pc_init1() into pc_basic_device_init() Isaku Yamahata
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 17/27] pc: split out pci device init from pc_init1() into pc_pci_device_init() Isaku Yamahata
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 18/27] pc: split out piix specific part from pc.c into pc_piix.c Isaku Yamahata
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 19/27] pc: move rtc declarations from pc.h into a dedicated header file Isaku Yamahata
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 20/27] rtc: make rtc_xxx accept/return ISADevice instead of RTCState Isaku Yamahata
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 21/27] acpi_piix4: qdevfy Isaku Yamahata
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 22/27] pci hotplug: add argument to pci hot plug callback Isaku Yamahata
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 23/27] pci hotadd, acpi_piix4: remove global variables Isaku Yamahata
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 24/27] pc_smbus: remove #ifdef DEBUG Isaku Yamahata
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 25/27] acpi_piix4: " Isaku Yamahata
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 26/27] pc_apm: " Isaku Yamahata
2010-01-05 6:27 ` [Qemu-devel] [PATCH V11 27/27] mc146818rtc: remove #ifdef DEBUG_CMOS Isaku Yamahata
2010-01-05 9:45 ` [Qemu-devel] Re: [PATCH V11 00/27] split out piix specific part from pc emulator and some clean ups Gerd Hoffmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).