From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:37129) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TJOzz-0004BD-8c for qemu-devel@nongnu.org; Wed, 03 Oct 2012 09:28:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TJOzr-0006Zi-Sg for qemu-devel@nongnu.org; Wed, 03 Oct 2012 09:28:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53095) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TJOzr-0006ZE-Jj for qemu-devel@nongnu.org; Wed, 03 Oct 2012 09:28:19 -0400 From: Eduardo Habkost Date: Wed, 3 Oct 2012 10:28:57 -0300 Message-Id: <1349270954-4657-2-git-send-email-ehabkost@redhat.com> In-Reply-To: <1349270954-4657-1-git-send-email-ehabkost@redhat.com> References: <1349270954-4657-1-git-send-email-ehabkost@redhat.com> Subject: [Qemu-devel] [RFC 01/18] pc: create "PC" device class List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Igor Mammedov , =?UTF-8?q?Andreas=20F=C3=A4rber?= , Gleb Natapov , Paolo Bonzini We can make it a child of a generic "machine" class later, but right now a "PC" class is needed to allow global-properties to control some details of CPU creation on the PC code. Signed-off-by: Eduardo Habkost --- hw/pc.c | 18 ++++++++++++++++++ hw/pc.h | 6 ++++++ 2 files changed, 24 insertions(+) diff --git a/hw/pc.c b/hw/pc.c index 7e7e0e2..9b68282 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -550,6 +550,24 @@ static void bochs_bios_write(void *opaque, uint32_t addr, uint32_t val) } } +typedef struct PC { + DeviceState parent_obj; +} PC; + +static const TypeInfo pc_type_info = { + .name = TYPE_PC_MACHINE, + .parent = TYPE_DEVICE, + .instance_size = sizeof(PC), + .class_size = sizeof(DeviceClass), +}; + +static void pc_register_type(void) +{ + type_register_static(&pc_type_info); +} + +type_init(pc_register_type); + int e820_add_entry(uint64_t address, uint64_t length, uint32_t type) { int index = le32_to_cpu(e820_table.count); diff --git a/hw/pc.h b/hw/pc.h index e4db071..77e898f 100644 --- a/hw/pc.h +++ b/hw/pc.h @@ -102,6 +102,12 @@ void i8042_setup_a20_line(ISADevice *dev, qemu_irq *a20_out); /* pc.c */ extern int fd_bootchk; +#define TYPE_PC_MACHINE "PC" +#define PC(obj) \ + OBJECT_CHECK(PC, (obj), TYPE_PC_MACHINE) +struct PC; +typedef struct PC PC; + void pc_register_ferr_irq(qemu_irq irq); void pc_acpi_smi_interrupt(void *opaque, int irq, int level); -- 1.7.11.4