From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JU63a-0006NQ-CX for qemu-devel@nongnu.org; Tue, 26 Feb 2008 15:05:43 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JU63U-0006Hy-MZ for qemu-devel@nongnu.org; Tue, 26 Feb 2008 15:05:40 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JU63S-0006Hr-5C for qemu-devel@nongnu.org; Tue, 26 Feb 2008 15:05:34 -0500 Received: from mx1.redhat.com ([66.187.233.31]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JU63R-0001G8-TR for qemu-devel@nongnu.org; Tue, 26 Feb 2008 15:05:34 -0500 From: Glauber Costa Date: Tue, 26 Feb 2008 16:56:39 -0300 Message-Id: <1204055805-32349-10-git-send-email-gcosta@redhat.com> In-Reply-To: <1204055805-32349-9-git-send-email-gcosta@redhat.com> References: <1204055805-32349-1-git-send-email-gcosta@redhat.com> <1204055805-32349-2-git-send-email-gcosta@redhat.com> <1204055805-32349-3-git-send-email-gcosta@redhat.com> <1204055805-32349-4-git-send-email-gcosta@redhat.com> <1204055805-32349-5-git-send-email-gcosta@redhat.com> <1204055805-32349-6-git-send-email-gcosta@redhat.com> <1204055805-32349-7-git-send-email-gcosta@redhat.com> <1204055805-32349-8-git-send-email-gcosta@redhat.com> <1204055805-32349-9-git-send-email-gcosta@redhat.com> Subject: [Qemu-devel] [PATCH 9/15] initialize hot add system. Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: kvm-devel@lists.sourceforge.net Cc: marcelo@kvack.org, glommer@gmail.com, qemu-devel@nongnu.org, Glauber Costa , chrisw@sous-sol.org Register the pios, and grab cpu_model for future usage. Signed-off-by: Glauber Costa --- qemu/hw/acpi.c | 34 ++++++++++++++++++++++++++++++++++ qemu/hw/pc.c | 1 + qemu/sysemu.h | 1 + 3 files changed, 36 insertions(+), 0 deletions(-) diff --git a/qemu/hw/acpi.c b/qemu/hw/acpi.c index d2e2e3e..119b59a 100644 --- a/qemu/hw/acpi.c +++ b/qemu/hw/acpi.c @@ -533,6 +533,40 @@ void qemu_system_powerdown(void) } } #endif +#define GPE_BASE 0xafe0 + +struct gpe_regs { + uint16_t sts; /* status */ + uint16_t en; /* enabled */ +}; + +static struct gpe_regs gpe; + +static uint32_t gpe_readb(void *opaque, uint32_t addr) +{ + uint32_t val = 0; +#if defined(DEBUG) + printf("gpe read %lx == %lx\n", addr, val); +#endif + return val; +} + +static void gpe_writeb(void *opaque, uint32_t addr, uint32_t val) +{ +#if defined(DEBUG) + printf("gpe write %lx <== %d\n", addr, val); +#endif +} + +static char *model; + +void qemu_system_hot_add_init(char *cpu_model) +{ + register_ioport_write(GPE_BASE, 4, 1, gpe_writeb, &gpe); + register_ioport_read(GPE_BASE, 4, 1, gpe_readb, &gpe); + + model = cpu_model; +} void qemu_system_cpu_hot_add(int cpu, int state) { diff --git a/qemu/hw/pc.c b/qemu/hw/pc.c index 982377d..ab69e5c 100644 --- a/qemu/hw/pc.c +++ b/qemu/hw/pc.c @@ -1020,6 +1020,7 @@ #endif } } + qemu_system_hot_add_init(cpu_model); #define USE_HYPERCALL #ifdef USE_HYPERCALL pci_hypercall_init(pci_bus); diff --git a/qemu/sysemu.h b/qemu/sysemu.h index fe929b4..5692114 100644 --- a/qemu/sysemu.h +++ b/qemu/sysemu.h @@ -155,6 +155,7 @@ extern int drive_get_max_bus(BlockInterf /* acpi */ void qemu_system_cpu_hot_add(int cpu, int state); +void qemu_system_hot_add_init(char *cpu_model); /* vmchannel devices */ -- 1.4.2