qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 1/2] Use defines instead of numbers for pci hotplug sts bit
@ 2010-10-17  9:45 Gleb Natapov
  2010-10-17  9:45 ` [Qemu-devel] [PATCH 2/2] Fix pci hotplug to generate level triggered interrupt Gleb Natapov
  2010-10-20 22:24 ` [Qemu-devel] [PATCH 1/2] Use defines instead of numbers for pci hotplug sts bit Anthony Liguori
  0 siblings, 2 replies; 3+ messages in thread
From: Gleb Natapov @ 2010-10-17  9:45 UTC (permalink / raw)
  To: qemu-devel


Signed-off-by: Gleb Natapov <gleb@redhat.com>
---
 hw/acpi_piix4.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/hw/acpi_piix4.c b/hw/acpi_piix4.c
index c8733e5..bec42b4 100644
--- a/hw/acpi_piix4.c
+++ b/hw/acpi_piix4.c
@@ -38,6 +38,8 @@
 #define PCI_BASE 0xae00
 #define PCI_EJ_BASE 0xae08
 
+#define PIIX4_PCI_HOTPLUG_STATUS 2
+
 struct gpe_regs {
     uint16_t sts; /* status */
     uint16_t en;  /* enabled */
@@ -596,13 +598,13 @@ static void piix4_acpi_system_hot_add_init(PCIBus *bus, PIIX4PMState *s)
 
 static void enable_device(PIIX4PMState *s, int slot)
 {
-    s->gpe.sts |= 2;
+    s->gpe.sts |= PIIX4_PCI_HOTPLUG_STATUS;
     s->pci0_status.up |= (1 << slot);
 }
 
 static void disable_device(PIIX4PMState *s, int slot)
 {
-    s->gpe.sts |= 2;
+    s->gpe.sts |= PIIX4_PCI_HOTPLUG_STATUS;
     s->pci0_status.down |= (1 << slot);
 }
 
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [Qemu-devel] [PATCH 2/2] Fix pci hotplug to generate level triggered interrupt.
  2010-10-17  9:45 [Qemu-devel] [PATCH 1/2] Use defines instead of numbers for pci hotplug sts bit Gleb Natapov
@ 2010-10-17  9:45 ` Gleb Natapov
  2010-10-20 22:24 ` [Qemu-devel] [PATCH 1/2] Use defines instead of numbers for pci hotplug sts bit Anthony Liguori
  1 sibling, 0 replies; 3+ messages in thread
From: Gleb Natapov @ 2010-10-17  9:45 UTC (permalink / raw)
  To: qemu-devel

SCI is level triggered. pci hotplug should behave appropriately.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
---
 hw/acpi_piix4.c |   28 +++++++++++++++++-----------
 1 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/hw/acpi_piix4.c b/hw/acpi_piix4.c
index bec42b4..f74f34c 100644
--- a/hw/acpi_piix4.c
+++ b/hw/acpi_piix4.c
@@ -107,7 +107,9 @@ static void pm_update_sci(PIIX4PMState *s)
                   (ACPI_BITMASK_RT_CLOCK_ENABLE |
                    ACPI_BITMASK_POWER_BUTTON_ENABLE |
                    ACPI_BITMASK_GLOBAL_LOCK_ENABLE |
-                   ACPI_BITMASK_TIMER_ENABLE)) != 0);
+                   ACPI_BITMASK_TIMER_ENABLE)) != 0) ||
+        (((s->gpe.sts & s->gpe.en) & PIIX4_PCI_HOTPLUG_STATUS) != 0);
+
     qemu_set_irq(s->irq, sci_level);
     /* schedule a timer interruption if needed */
     if ((s->pmen & ACPI_BITMASK_TIMER_ENABLE) &&
@@ -462,7 +464,9 @@ static uint32_t gpe_read_val(uint16_t val, uint32_t addr)
 static uint32_t gpe_readb(void *opaque, uint32_t addr)
 {
     uint32_t val = 0;
-    struct gpe_regs *g = opaque;
+    PIIX4PMState *s = opaque;
+    struct gpe_regs *g = &s->gpe;
+
     switch (addr) {
         case GPE_BASE:
         case GPE_BASE + 1:
@@ -502,7 +506,9 @@ static void gpe_reset_val(uint16_t *cur, int addr, uint32_t val)
 
 static void gpe_writeb(void *opaque, uint32_t addr, uint32_t val)
 {
-    struct gpe_regs *g = opaque;
+    PIIX4PMState *s = opaque;
+    struct gpe_regs *g = &s->gpe;
+
     switch (addr) {
         case GPE_BASE:
         case GPE_BASE + 1:
@@ -514,7 +520,9 @@ static void gpe_writeb(void *opaque, uint32_t addr, uint32_t val)
             break;
         default:
             break;
-   }
+    }
+
+    pm_update_sci(s);
 
     PIIX4_DPRINTF("gpe write %x <== %d\n", addr, val);
 }
@@ -581,11 +589,10 @@ static int piix4_device_hotplug(DeviceState *qdev, PCIDevice *dev, int state);
 
 static void piix4_acpi_system_hot_add_init(PCIBus *bus, PIIX4PMState *s)
 {
-    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(GPE_BASE, 4, 1, gpe_writeb, s);
+    register_ioport_read(GPE_BASE, 4, 1,  gpe_readb, s);
 
     register_ioport_write(PCI_BASE, 8, 4, pcihotplug_write, pci0_status);
     register_ioport_read(PCI_BASE, 8, 4,  pcihotplug_read, pci0_status);
@@ -621,9 +628,8 @@ static int piix4_device_hotplug(DeviceState *qdev, PCIDevice *dev, int state)
     } else {
         disable_device(s, slot);
     }
-    if (s->gpe.en & 2) {
-        qemu_set_irq(s->irq, 1);
-        qemu_set_irq(s->irq, 0);
-    }
+
+    pm_update_sci(s);
+
     return 0;
 }
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH 1/2] Use defines instead of numbers for pci hotplug sts bit
  2010-10-17  9:45 [Qemu-devel] [PATCH 1/2] Use defines instead of numbers for pci hotplug sts bit Gleb Natapov
  2010-10-17  9:45 ` [Qemu-devel] [PATCH 2/2] Fix pci hotplug to generate level triggered interrupt Gleb Natapov
@ 2010-10-20 22:24 ` Anthony Liguori
  1 sibling, 0 replies; 3+ messages in thread
From: Anthony Liguori @ 2010-10-20 22:24 UTC (permalink / raw)
  To: Gleb Natapov; +Cc: qemu-devel

On 10/17/2010 04:45 AM, Gleb Natapov wrote:
> Signed-off-by: Gleb Natapov<gleb@redhat.com>
>    

Applied both.  Thanks.

Regards,

Anthony Liguori

> ---
>   hw/acpi_piix4.c |    6 ++++--
>   1 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/hw/acpi_piix4.c b/hw/acpi_piix4.c
> index c8733e5..bec42b4 100644
> --- a/hw/acpi_piix4.c
> +++ b/hw/acpi_piix4.c
> @@ -38,6 +38,8 @@
>   #define PCI_BASE 0xae00
>   #define PCI_EJ_BASE 0xae08
>
> +#define PIIX4_PCI_HOTPLUG_STATUS 2
> +
>   struct gpe_regs {
>       uint16_t sts; /* status */
>       uint16_t en;  /* enabled */
> @@ -596,13 +598,13 @@ static void piix4_acpi_system_hot_add_init(PCIBus *bus, PIIX4PMState *s)
>
>   static void enable_device(PIIX4PMState *s, int slot)
>   {
> -    s->gpe.sts |= 2;
> +    s->gpe.sts |= PIIX4_PCI_HOTPLUG_STATUS;
>       s->pci0_status.up |= (1<<  slot);
>   }
>
>   static void disable_device(PIIX4PMState *s, int slot)
>   {
> -    s->gpe.sts |= 2;
> +    s->gpe.sts |= PIIX4_PCI_HOTPLUG_STATUS;
>       s->pci0_status.down |= (1<<  slot);
>   }
>
>    

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-10-20 22:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-17  9:45 [Qemu-devel] [PATCH 1/2] Use defines instead of numbers for pci hotplug sts bit Gleb Natapov
2010-10-17  9:45 ` [Qemu-devel] [PATCH 2/2] Fix pci hotplug to generate level triggered interrupt Gleb Natapov
2010-10-20 22:24 ` [Qemu-devel] [PATCH 1/2] Use defines instead of numbers for pci hotplug sts bit Anthony Liguori

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).